Subscribe Bookmark RSS Feed

Place Data Table into a Custom Window via JSL

tomlight

Community Trekker

Joined:

Mar 2, 2016

Hi all,

In my current project, I am writing a script to run several scripts already associated with a data table and then "copy+paste" each result window to a new window, with the final goal that the "new window" will contain every needed result image for a report.

For scripts that produce a proper report, this is fairly easy and can be accomplished like this:

::winOut = New Window( "Out", ::boxOut = V List Box() );

::dtMain = Current Data Table();


::boxOut << Append( Text Box( "||Variablity Chart for All Weeks" ) );

::boxOut << Append( (::dtMain << Run Script( "VarChart All weeks" )) << Report );



However, things aren't working out so easy for scripts that produce a data table (i.e., a sub-table of the main data table).


What would need to be done to append a data table to my "::winOut"? I know a command such as


::dataTable << LayOut


Will produce an "image" that matches what I want to append, but I can't figure out how to append that (or anything similar) to my ::winOut


I should note that this is my third day of scripting via JSL, so there are probably many "tricks" that I am unaware of.


As an example This is what I have so far...


::boxOut << Append( Text Box( "||Table of Averages" ) );

::dtMain << run script( "Table of Averages" );

::dtTemp = (DataTable("Table of Averages"));

::boxOut << append(???);

Close(::dtTemp);

Also, as a caveat, there are "trust issues" with modifying the existing scripts. I won't be able to alter "Table of Averages" in any way, all of this must be done outside of those existing scripts.

Thanks for the help,

-Tom

1 ACCEPTED SOLUTION

Accepted Solutions
Solution

Hello, Tom.

You can send the Get As Report message to the data table object to return a DisplayBox object of the table.  For your example, your code might look like this:

::boxOut << Append( ::dtTemp << Get As Report );

So how do you find out about messages like this?  You can find all the messages available for an object, along with script examples, in the Scripting Index.  To view the Scripting Index, click on the Help menu and select Scripting Index.  Just below the search box, ensure "All Categories" is selected in the dropdown.  Scroll down to and select the object you are working with - in this case, Data Table.  The Items list will contain all the messages appropriate for the object.  As you select messages in the Items list, the right side of the window will be updated with the generic syntax, a brief description, and an example script that can be run directly from the Scripting Index.

I hope this is helpful.

Wendy

Wendy
4 REPLIES
ian_jmp

Staff

Joined:

Jun 23, 2011

Have you tried 'DataTableBox()'? Do 'Help > Scripting Guide' and search for this to see an example.

If you are starting out with JSL this is generally a good resource, along with 'Help > Books > Scripting Guide' of course.

tomlight

Community Trekker

Joined:

Mar 2, 2016

Hi Ian!

Thanks for your help. This seems to work at first, but as soon as the datatable referenced by DataTableBox() is closed, the DataTableBox within ::winOut also closes/disappears (which is curious behavior).

But thank you for the help locating the Scripting resources, those are certainly going to make my work easier

Solution

Hello, Tom.

You can send the Get As Report message to the data table object to return a DisplayBox object of the table.  For your example, your code might look like this:

::boxOut << Append( ::dtTemp << Get As Report );

So how do you find out about messages like this?  You can find all the messages available for an object, along with script examples, in the Scripting Index.  To view the Scripting Index, click on the Help menu and select Scripting Index.  Just below the search box, ensure "All Categories" is selected in the dropdown.  Scroll down to and select the object you are working with - in this case, Data Table.  The Items list will contain all the messages appropriate for the object.  As you select messages in the Items list, the right side of the window will be updated with the generic syntax, a brief description, and an example script that can be run directly from the Scripting Index.

I hope this is helpful.

Wendy

Wendy
tomlight

Community Trekker

Joined:

Mar 2, 2016

Hi Wendy,

That works perfectly! Thank you for your help and your overview of the Scripting Index