RR

I'm not sure if this is the proper place to post my question, so please remove it, or move it, if it's not in the proper place.

I want to create a report, which runs on group context, and... for the objects in a given group... it prints in Excel the names... and the graphic representations... of the objects' default symbols. After reading Ms. Klein's tutorials, and looking at the Aris help for some clarifications, I came up with the code below.

But it outputs only the symbols' graphic representations... Without the names of the names of the symbols. Basically, it overwrites the text, and shows only the graphics.

I think that the write( ) method of the Excel workbook overwrites the other content of the report, how can I avoid this?

 
var localeId = Context.getSelectedLanguage();
var outFile = Context.createOutputObject( Constants.OUTEXCEL, "some_report.xls" );

var workbook = Context.createExcelWorkbook( Context.getSelectedFile( ) );
var sheet = workbook.createSheet( null );

main( );

function main( ) {
    
    outFile.BeginTable(100, Constants.C_BLACK, Constants.C_TRANSPARENT, Constants.FMT_LEFT, 5 );
    
    outFile.TableRow( );
    outFile.TableCell( "Symbol Name", 34, "Arial", 10, Constants.C_BLACK, Constants.C_WHITE, 0, Constants.FMT_LEFT | Constants.FMT_VCENTER, 5 );
    outFile.TableCell( "Symbol Graphic", 34, "Arial", 10, Constants.C_BLACK, Constants.C_WHITE, 0, Constants.FMT_LEFT | Constants.FMT_VCENTER, 5 );
    
    var groups = ArisData.getSelectedGroups( );         
        
    for( var i = 0; i < groups.length; i++ ) {
        
        var currentGroup = groups[ i ]; 
        writeGroupObjects( currentGroup );
    }
    
    outFile.EndTable( "", 100, "Arial", 12, Constants.C_BLACK, Constants.C_TRANSPARENT, 0, Constants.FMT_LEFT | Constants.FMT_VTOP, 5 );
    
    outFile.WriteReport( );
    workbook.write( );
}

function writeGroupObjects( currentGroup ) {
  
    var objectDefinitions = currentGroup.ObjDefList( );
    
    if( objectDefinitions.length > 0 ) {
        
        for( var i = 0; i < objectDefinitions.length; i++ ) {
            
            var currentObjectDefinition = objectDefinitions[ i ];
            
            var defaultSymbolNum = currentObjectDefinition.getDefaultSymbolNum( );
            var filter = ArisData.ActiveFilter( );
            
            var defaultSymbolName = filter.SymbolName( defaultSymbolNum );
            var defaultSymbolGraphic = filter.SymbolGraphic( defaultSymbolNum );
            
            var picName = "symbol" + i + ".png";
            defaultSymbolGraphic.Save( outFile, picName );
            var picture = Context.getFile( picName, Constants.LOCATION_OUTPUT );
            
            outFile.TableRow( );
            outFile.TableCell( defaultSymbolName, 34, "Arial", 10, Constants.C_BLACK, Constants.C_WHITE, 0, Constants.FMT_LEFT | Constants.FMT_VCENTER, 5 );
            
            sheet.setPicture ( picture, 1, i+1, 2, i+2 );
            Context.deleteFile( picName );  
        }
    }
}

 

by Francois Du Toit
Posted on Wed, 08/03/2011 - 13:16

Hi Roger,

I had the same issue once, the grpahic you output is put in the top-left corner and effectively hides the text, you just need to add another column to show the text seperately. I would change the whole script like below:

Your first problem was that you created 2 output files and only the last one was opened.

The second, I dont know why you felt you had to save and then delete the images.

script:

var localeId = Context.getSelectedLanguage();
var outFile = Context.createOutputObject( Constants.OUTEXCEL, "some_report.xls" );
 
 
main( );
 
function main( ) {
     
    outFile.BeginTable(100, Constants.C_BLACK, Constants.C_TRANSPARENT, Constants.FMT_LEFT, 5 );
     
    outFile.TableRow( );
    outFile.TableCell( "Symbol Name", 34, "Arial", 10, Constants.C_BLACK, Constants.C_WHITE, 0, Constants.FMT_LEFT | Constants.FMT_VCENTER, 5 );
    outFile.TableCell( "Symbol Graphic", 34, "Arial", 10, Constants.C_BLACK, Constants.C_WHITE, 0, Constants.FMT_LEFT | Constants.FMT_VCENTER, 5 );
     
    var groups = ArisData.getSelectedGroups( );         
         
    for( var i = 0; i < groups.length; i++ ) {
         
        var currentGroup = groups[ i ]; 
        writeGroupObjects( currentGroup );
    }
     
    outFile.EndTable( "", 100, "Arial", 12, Constants.C_BLACK, Constants.C_TRANSPARENT, 0, Constants.FMT_LEFT | Constants.FMT_VTOP, 5 );
     
    outFile.WriteReport( );
}
 
function writeGroupObjects( currentGroup ) {
   
    var objectDefinitions = currentGroup.ObjDefList( );
     
    if( objectDefinitions.length > 0 ) {
         
        for( var i = 0; i < objectDefinitions.length; i++ ) {
             
            var currentObjectDefinition = objectDefinitions[ i ];
             
            var defaultSymbolNum = currentObjectDefinition.getDefaultSymbolNum();
            var filter = ArisData.ActiveFilter( );
             
            var defaultSymbolName = filter.SymbolName( defaultSymbolNum );
            var defaultSymbolGraphic = filter.SymbolGraphic( defaultSymbolNum );
             
            outFile.TableRow( );
            outFile.TableCell( defaultSymbolName, 34, "Arial", 10, Constants.C_BLACK, Constants.C_WHITE, 0, Constants.FMT_LEFT | Constants.FMT_VCENTER, 5 );
            outFile.TableCell("", 34, "Arial", 10, Constants.C_BLACK, Constants.C_WHITE, 0, Constants.FMT_LEFT | Constants.FMT_VCENTER, 5 );
            outFile.OutGraphic(defaultSymbolGraphic, -1, 20, 20);
        }
    }
}

I hope this helps, good luck with your scripting.

Rgs,

Francois

0
by Nabil Benmessaoud
Posted on Fri, 10/28/2011 - 14:26

Hi,

 I used the two functions SymbolGraohic and OutGraphic to display symbol graphics in a word report: outfile.OutGraphic(selectedFilter.SymbolGraphic(symbolNum), -1, 10, 10);

but it works partially.

 I can only display graphics of this type  “EmfPicture@..." and graphics of this type “BitmapPicture@...” are not displayed.

Do you have any suggestion?

 

Thanks

0

Featured achievement

Question Solver
Share your expertise and have your answer accepted as best reply.
Recent Unlocks
  • CR
  • BH
  • Profile picture for user Ivan.Ivanov.softwareag.com
  • Profile picture for user mscheid
  • MS
  • 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