Report-Output to two files

Translate this pagebookmark or share this page
Dominik's picture

Posted: 2012-05-03
1095 views | 6 comments | category: ARIS Support

5
show all articles
Why should I use a library for roles etc.
Dominik's picture

Group: ARIS Support

678 views | 4 comments
0
show all articles
[SOLVED] How to: Highlight ObjOcc in Model only for reporting
Dominik's picture

Group: Reports & Macros in ARIS

586 views | 2 comments
5
show all articles
Access Permission on Attribute
Dominik's picture

Group: ARIS Support

420 views | 2 comments
0
show all articles
[SOLVED] Variant-Methods not available on ObjDef
Dominik's picture

Group: Reports & Macros in ARIS

352 views | 1 comments
0
show all articles
Show Link-Attributs in Publisher
Dominik's picture

Group: We Love BPM

304 views | 0 comments
0
show all articles
How to manipulate placed attributes on an occurance by report
Dominik's picture

Group: Reports & Macros in ARIS

780 views | 3 comments
0
show all articles
Changelog of Modelchanges
Dominik's picture

Group: ARIS Support

478 views | 2 comments
0
show all articles
How to report formated attributes like AT_DESC
Dominik's picture

Group: Reports & Macros in ARIS

810 views | 4 comments
0
show all articles
DB-Defined Header an Footer is not visible in print outs
Dominik's picture

Group: ARIS Support

639 views | 5 comments
0
show all articles
How to number Objects (semi-automatic)
Dominik's picture

Group: Reports & Macros in ARIS

1600 views | 7 comments
5
show all articles
Comments
Jens's picture

Hi Dominik,

try to use:

 

Report class Context - Method addOutputFile

 

addOutputFile ( String p_sFileName, byte[] p_fileData )

Adds the specified file to list of files to be transfered to the client.  

 

Cheers,

Jens 

Dominik's picture

Hi Jens,

thanks for this.

I get an TypeError, saying that this function cannot be found.

And second, how can I put the Data into p_fileData?

What I have is:

var oOutDef = Context.createOutputObject()
oOutDef.OutputF("blabla", getString("ID_STYLE_RD_DEFAULT"))
oOutDef.WriteReport()

This works with opening Excel. With your Info, I tried this:

var oOutDef = Context.addOutputFile("text.xls",p_fileData)
oOutDef.OutputF("blabla", getString("ID_STYLE_RD_DEFAULT"))
oOutDef.WriteReport()

 

Jens's picture

Hi Dominik,

in this case I think

 

addOutputFileName ( String p_sFileID, int p_nLocation )

 

is better. You have to do the following:

 

1. Create a output object with a given filename

var out = Context.createOutputObject ( Constants.OUTEXCEL,  filename );

2. Add some content

out.OutputF("blabla", getString("ID_STYLE_RD_DEFAULT"));

3. Add the output file to transfer

Context.addOutputFileName(filename, Constants.LOCATION_OUTPUT);  

 4. Call WriteReport

out.WriteReport( Context.getSelectedPath(), filename );

 

 

Jens

 

 

Dominik's picture

Hi Jens,

Thanks. It almost works. Im running in trouble with the 4th statement.

When I read the ARIS help to the WriteReport(String,String)-Statement, there is documented, that the first parameter (p_sSelectedPath) will be ignored. This fits the current error. The report does not try to save the report where I like, he chooses "D:\ARIS7.2\server\temp\ReportTemp\5\text.xlsx. This is a directory that does not exist on the client. This is the server-directory, and none of the users later have access to this share. Even when the file will be stored there. They can't get the report by file-explorer.

So, how can the correct place be defined?

I have a var for this:

var selClientFolders = Dialogs.getClientFolder("Select new output folder", "", false)

What can be done?

Dominik

Jens's picture

Here an example writing two files. Send to client in a folder selected by the user:

function main() {
    
 var out = Context.createOutputObject ( Constants.OUTEXCEL,  Context.getSelectedFile() );
 out.DefineF("F1", "ARIAL", 8, Constants.C_BLACK, Constants.C_TRANSPARENT, Constants.FMT_LEFT, 0, 21, 0, 0, 0, 1);
 out.BeginTable(100, Constants.C_BLACK, Constants.C_TRANSPARENT, Constants.FMT_CENTER, 0); 
 out.TableRow();
 out.TableCellF("BlaBLa", 100, "F1");
 out.EndTable(" ", 100, "ARIAL", 10, Constants.C_BLACK, Constants.C_TRANSPARENT, 0, Constants.FMT_CENTER | Constants.FMT_VCENTER|Constants.FMT_BOLD, 0); 
 
 var filename = "secondfile.xls";
 var out2 = Context.createOutputObject ( Constants.OUTEXCEL, filename );
 out2.DefineF("F1", "ARIAL", 8, Constants.C_BLACK, Constants.C_TRANSPARENT, Constants.FMT_LEFT, 0, 21, 0, 0, 0, 1);
 out2.BeginTable(100, Constants.C_BLACK, Constants.C_TRANSPARENT, Constants.FMT_CENTER, 0); 
 out2.TableRow();
 out2.TableCellF("BlaBLa2", 100, "F1");
 out2.EndTable(" ", 100, "ARIAL", 10, Constants.C_BLACK, Constants.C_TRANSPARENT, 0, Constants.FMT_CENTER | Constants.FMT_VCENTER|Constants.FMT_BOLD, 0);  
 out2.WriteReport();
 Context.addOutputFileName(filename, Constants.LOCATION_OUTPUT);
 
 var selClientFolders = Dialogs.getClientFolder("Select new output folder", "", false);
 if( selClientFolders != null ) {
    for each( folder in selClientFolders ) {
        Context.setSelectedPath( folder );
    }    
 }
 out.WriteReport();
 
}
main();
Dominik's picture

Thanks, this solution works!