AS

Hi,

I'm creating two different files (bla.xml and bla_bla.xls) using Report script and trying to save them in different locations what does not work. I changed Context.setSelectedPath(...) for each of them but both of them are going to the same path(last one). I also tried to delete or rename created files with Context.deleteFile(...) / __renameFile(...) commands that did not work also. What is wrong? The  Context.deleteFile(...)  returns true but keeps the file empty(corrupted). The report has  two output file formats: xml and xls. Could be a reason?

Thanks.

by Martin Schröder
Badge for 'Contributor' achievement
Posted on Wed, 01/27/2016 - 16:13

Hello Albina,

I did not try it myself, but just a thought:

If you want ot output a second file to a different context, you would need to close the first output object (with writeReport() ) and then create a new output object and set a new path.

Regards, Martin

0
by Svetoslav Savachki
Posted on Mon, 01/28/2019 - 13:49

Hello Guys,



I have a problem similar to Albina's. I have to extract different files in different folders. I have image file that is retrieved from a model:

var image = modelDef.Graphic(false, false, nLocale, false);
var contextCurrentTempPath = getSubDir(itemTypeCode, itemType) + "\\"; //custom function to get the right subdirectory
Context.setSelectedPath(contextCurrentTempPath);
var output = Context.createOutputObject();

image.Save(output, fileName);
Context.addOutputFileName(fileName, Constants.LOCATION_OUTPUT);



This works by itself, but the function that calls that code, also calls another piece of code, which should create an Excel sheet.

Context.setSelectedPath(rootDir);//rootDir is the path where the Excel file should be save
workbook.write();
Context.addOutputFileName("ExcelFilename.xls");

Currently, the way the code works is that it saves the JPG image files in the same location as the Excel file - rootDir .

I figured that this is because all the files that were created during the report run, are transferred over to the target dir

Context.setSelectedPath(rootDir)

, only when the report is finished.

Therefore I though that there should be a way to transfer the generated files while the report is still running. I tried using the following code:

var image = modelDef.Graphic(false, false, nLocale, false);
var contextCurrentTempPath = getSubDir(itemTypeCode, itemType) + "\\"; //custom function to get the right subdirectory
Context.setSelectedPath(contextCurrentTempPath);
var output = Context.createOutputObject();

Context.addOutputFileName(fileName, Constants.LOCATION_OUTPUT);
output.OutGraphic(image, 100, 210, 297);
output.WriteReport();

Unfortunately, that did not work - no image files are generated at all, even in the server's temp directory.
I would appreciate any suggestion or help.

0

Featured achievement

Question Solver
Share your expertise and have your answer accepted as best reply.
Recent Unlocks
  • CP
  • BZ
  • Profile picture for user TEF_Bernd
  • ПЦ
  • CR
  • PacMan

Leaderboard

|
icon-arrow-down icon-arrow-cerulean-left icon-arrow-cerulean-right icon-arrow-down icon-arrow-left icon-arrow-right icon-arrow icon-back icon-close icon-comments icon-correct-answer icon-tick icon-download icon-facebook icon-flag icon-google-plus icon-hamburger icon-in icon-info icon-instagram icon-login-true icon-login icon-mail-notification icon-mail icon-mortarboard icon-newsletter icon-notification icon-pinterest icon-plus icon-rss icon-search icon-share icon-shield icon-snapchat icon-star icon-tutorials icon-twitter icon-universities icon-videos icon-views icon-whatsapp icon-xing icon-youtube icon-jobs icon-heart icon-heart2 aris-express bpm-glossary help-intro help-design Process_Mining_Icon help-publishing help-administration help-dashboarding help-archive help-risk icon-knowledge icon-question icon-events icon-message icon-more icon-pencil forum-icon icon-lock