Hello all,
I am trying to tabulate multi cases based on a specific column value in for loop.
categorizes = Column(dt, "Categorize");
columnValues = Associative Array(categorizes << Get Values) << Get Keys;
For(i = 1, i <= N Items(columnValues), i++,
currentItem = columnValues[i];
obLoopY = Outline Box("categorize" || Char(currentItem),
dt << Tabulate(
Page Column(:Categorize(Char(currentItem))),
Show Control Panel(0),
Add Table(
Column Table(
Grouping Columns(:Underlayer, :RefEntity),
Analysis Columns(:M3S_Y)
),
Row Table(Grouping Columns(:TargetEntity))
),
SendToReport(Dispatch({}, "", TextBox, {Set Base Font("Heading")}))
)
);
boxY << append(obLoopY);
);
Problem is, the currentItem contains the columnValues from Categorize column.
If I just specify the item value, let's say "a" as one of columnValues.
I added Page Column( :Categorize( "a" ) ) into Tabulate method, then it works.
But I needed to run all values from for loop, I tried to make it Page Column( :Categorize( currentItem ) ), but it did not work and just gave me the whole value at once instead of splitting by currentItem.
I tried Page Column( :Categorize( currentItem ) ), Page Column( :Categorize( char(currentItem) ) ), but neither of them worked. Probably there is a very easy solution but I could not find it.
Anyone can help?
Thanks in advance
Edit (jthi): Added jsl formatting
You might have to evaluate the values, below is an example using JMP's sample table
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
Summarize(dt, groups = By(:sex));
New Window("test",
collector = H List Box()
);
For Each({group}, groups,
ob = Outline Box("Categorize " || group,
tab = dt << Tabulate(
Show Control Panel(0),
Add Table(
Column Table(Analysis Columns(:height, :weight), Statistics(Mean)),
Row Table(Grouping Columns(:age))
)
);
Eval(EvalExpr(
tab << page column(:sex(Expr(group)));
));
);
collector << Append(ob);
);

If the layout is fine, By might also be an option
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
tab = dt << Tabulate(
Show Control Panel(0),
Add Table(
Column Table(Analysis Columns(:height, :weight), Statistics(Mean)),
Row Table(Grouping Columns(:age))
),
By(:sex),
Group Options(Layout("Horizontal List"))
);

Thanks using By also removes unnecessary for loop!