- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Help for Fit Y by X using For Loop
Hi all, hope somebody can help me with this request, I am trying to write a JSL script to create multiple Analysis Fit Y to X using a where condition, then I need to save every analysis generated with the values of the column used for Where as JPEG file.
So far, this is my initial script but I noticed that I am just creating a repeated analysis (times the tools used for "Where"), I guess my error is somewhere on how I specify the N items. I am adding also a sample table for the data.
Thank you in advance.
Names Default To Here( 1 );
dt = Current Data Table();
summarize(groupid = by(:TOOL));
show (groupid);
For( i = 1, i <= N Items( groupid ), i++,
pic = dt << Oneway(
Y( :Measure ),
X( :Processdate ),
Where ( :TOOL == groupid [i]);
pic << Save Picture( "E:\Sample\FitYbyX_" || groupid[i] ||".jpg", JPEG );
););
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Help for Fit Y by X using For Loop
I think it might be better to use :TOOL in the By role and then iterate over the results:
Names Default To Here( 1 );
dt = Current Data Table();
Summarize( groupid = by( :TOOL ) );
Show( groupid );
ow = dt << Oneway( Y( :Measure ), X( :Processdate ), By( :TOOL ) );
For( i = 1, i <= N Items( groupid ), i++,
pic = ow[i] << Save Picture( "E:\Sample\FitYbyX_" || groupid[i] || ".jpg", JPEG )
);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Help for Fit Y by X using For Loop
I think it might be better to use :TOOL in the By role and then iterate over the results:
Names Default To Here( 1 );
dt = Current Data Table();
Summarize( groupid = by( :TOOL ) );
Show( groupid );
ow = dt << Oneway( Y( :Measure ), X( :Processdate ), By( :TOOL ) );
For( i = 1, i <= N Items( groupid ), i++,
pic = ow[i] << Save Picture( "E:\Sample\FitYbyX_" || groupid[i] || ".jpg", JPEG )
);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Help for Fit Y by X using For Loop
Thank you @Mark_Bailey this is exactly what I need.