JSL Script using loops and summaryNeed any suggestion on how to make this loop work: itt keeps hiccuping at the line with Group( Box(i) ) and i thought it was an issue with number or brackets / incorrect column names. but adjust these did not help
For( j = 1, j < 3, j++,
nrj j = dt1 << Summary(
Group( Box(i) ),
Freq( "None" ),
Weight( "None" ),
Link to original data table( 0 ),
output table name( "Sum " || Char (j) )
);
);
ScriptingRe: JSL Script using loops and summary// I am assuming that your syntax of
// nrj j = dt1 << Summary(
// was an attempt to create a pointer to each new data table
// being created in the Loop, one for each column in the list
// of columns called "Box"
// To do that, one needs to create a new List variable, and then
// populate the list by inserting the new data table reference
// by using an "Insert Into()" on each loop
// Create a list variable to hold the data table references
mrj = {};
For( j = 1, j < 3, j++,
newDT = dt1 << Summary(
// Your reference to the list variable called "Box"
// Group( Box(i) ),
// incorrect for 2 reasons. 1. When referencing a
// subscript, it is done using square brackets [ ],
// 2. the index variable you are specifying is "i",
// while the index variable for your For() loop is
// a the variable "j"
Group( Box[j] ),
Freq( "None" ),
Weight( "None" ),
Link to original data table( 0 ),
output table name( "Sum " || Char( j ) )
);
Insert Into( mrj, newDT );
);
Re: JSL Script using loops and summaryThank you Jim.
I understand the need to add the list variable & the typo. however when i updated the code- & ran it , i get this error. My Column names are "Box 1" . "Box 2" etc.
However i did try changing the column names to Box1 , Box 2 and Box3 etc , and got the same error. any suggestions?

Re: JSL Script using loops and summaryI assumed that Box was referencing a memory variable called Box which is a list, and contains several elements, each one being the name of a variable. If this isn't it, what is Box?