scripting "add row" with dynamic list inputHi All,
I have a TableBox as report table in my journal. I can fill this table with "add row" which as input requires a list. This works when I directly write the list values in the function. See below. When I prepare the list however upfront and parse this into the function it doesn't work anymore See second example underneath. Why? The goal is to built this "add row" into a loop with each time different information.
Bauke
// possible and working
ob[TableBox(1)] << add row ({"1","2","3",4});
// not possible why?
rowContents2 = {"1","2","3",4};
ob[TableBox(1)] << add row (rowContents2);
Mass CustomizationRe: scripting "add row" with dynamic list inputThe reason it works, is what the code is simply doing, is building the exact JSL needed into a character string, and then using the Eval(Parse(…….)) to tell JMP to submit the character strings value to JMP.
If you take your specific example, the hard coded syntax to accomplish what you want is
ob[TableBox(1)] << add row ({"1", "2", "3", 4});
So, if one can build the above line of code into a character string, the character string can then be submitted to JMP using the Eval(Parse()) combination of functions. Here is a simple expansion of your script to hopefully make this clear
rowContents2 = {"1","2","3",4};
// Create a character string variable with the required syntax
myString = "ob[TableBox(1)] << add row (" || char(rowContents2) || ");";
// Write the string to the log to show what it looks like
show( myString );
// Run the character string variable
Eval( Parse( myString ) );
Re: scripting "add row" with dynamic list inputThanks a lot!
The first didn't work. The second solution did work when adding 2 missing brackets at the end. I do not understand yet why it works, however perhaps I will find that out later.
Bauke
Re: scripting "add row" with dynamic list inputtry the options in the below script. (Note: 2 trailing ")" were added to make the syntax correct, after @Bauke observation of the missing characters)
rowContents2 = {"1","2","3",4};
ob[TableBox(1)] << add row (eval(rowContents2));
// or if necessary this should force it to work
eval(parse("ob[TableBox(1)] << add row (" || char(rowContents2) || ");"));