Profile picture for user RBeddoe

Hello! This is my first post in the ARIS forums.

I am currently exploring ARIS script for reports. I have a request to consolidate several reports into one report. In my OOP experience, I would accomplish something like this by instantiating each report 'class' and then access its properties directly. Ex.:

var oReport_A = <reportObject_A>

var oReport_B = <reportObject_B>

var oReport_C = <reportObject_C>

where <reportObject_x> represents the individual report 'class' for each report I need to work with.

In Aris, I have tried this code:

var Report = Context.getComponent("Report");

var shadowCheck = Report.createExecInfo("Model_Quality/1d6f1570-f61c-11de-04b2-0050569749e7", ArisData.getSelectedModels(), Context.getSelectedLanguage());

But this returns an 'ExecInfo' object. I would like to access a 'Report' object then run the method inside it.

I realize I can use Imported files... to import the report as a reference, but all of the reports I want to import have a common method and I want to call that method exclusive to each report.

Thanks for your help!

Regards,

Rick Beddoe

by Amol Patil
Posted on Fri, 09/23/2011 - 22:17

Hi Rick,

The code you tried is for calling different report from one report. So the report which is being called should have one global function call.

If you import report through Imported Files, you will have to remove any global function call from those reports, and should keep the function names different. Then you can just call the functions in your code.

But i guess you are not looking for above two options. You might want to use the functions in the form of Class and methods. So here is the solution. You will need to import the reports through Imported Files

// Report 1
Report1 = function() {
     this.Value = "Report 1";
     this.CommonMethod = function() {
          // Code
     }
}

// Report 2
Report2 = function() {
     this.Value = "Report 2";
     this.CommonMethod = function() {
          // Code
     }
}

// Import both the above reports in the main report through "Imported Files"
// Your code in Main report

var g_Report1 = new Report1();
Dialogs.MsgBox(g_Report1.value);
g_Report1.CommonMethod();

var g_Report2 = new Report2();
Dialogs.MsgBox(g_Report2.value);
g_Report2.CommonMethod();

 

Regards,

Amol Patil

0
by Rick Beddoe Author
Posted on Mon, 09/26/2011 - 20:38

Very cool. Thanks Amol!

 

 

0
by Amol Patil
Posted on Mon, 09/26/2011 - 21:10

Hi Rick,

Yes, the thing you tried is correct.

Thanks,

Amol Patil

0
by Rick Beddoe Author
Posted on Mon, 09/26/2011 - 23:03

Thanks Amol,

I removed 'the thing I tried' from my post as I had figured it out. But just to have some closure to the thread, here's what I did:

//this simply reads an XML file and displays it in a browser window

//this is code that already existed in the report and I did not want to add additional code to it directly

function loadXmlFile(test) {

   

        Dialogs.MsgBox(test);

        var xmlData = Context.getFile("GUIDs.xml", Constants.LOCATION_COMMON_FILES);

        var xReader = Context.getXMLParser(xmlData);

        var xDoc = xReader.getDocument();

        var xmlOutput = Context.createXMLOutputObject("settings.xml", xReader.getDocument());

        return xmlOutput;

}



//this calls the existing code

//the value is passed to the existing code by using the 'property' (this.Value).

//This was 'the thing I tried' and it worked great.

Report1 = function() {

this.Value = "Report 1";

this.CommonMethod = function()

{

    loadXmlFile(this.Value).WriteReport();

        }

}

 

//this code can exist in any other report as long as THIS report is referenced

var g_Report1 = new Report1();

Dialogs.MsgBox(g_Report1.Value);

g_Report1.CommonMethod();

Thanks again, Amol

Rick Beddoe

Cargill Aris Technical Analyst

Minneapolis, MN, USA

0
by Amol Patil
Posted on Thu, 09/29/2011 - 19:29

Perfect sir,

 

Thanks,

Amol Patil

0

Featured achievement

Rookie
Say hello to the ARIS Community! Personalize your community experience by following forums or tags, liking a post or uploading a profile picture.
Recent Unlocks

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