Integration of a For loop generated string with Graph BuilderI am having difficulty getting the script below to run. I and trying to create custom plots using graph builder. I want to make it so creates a new plot according to the amount of data being analyzed and plot a custom map that I made around each data set "wafer2" (the variable i am trying to do this with is called "Dmaps"). I also want it to adjust the scalebar based upon the analysis recipe chosen by a user (This part of the script is working just fine ignore "Dscale" references). What I am struggling with is getting either the string I am generating with my for loop to have the right syntax or getting that string to integrate correctly with the graph builder script. Can anyone tell me what I am missing.
Thanks,
names default to here(1);
UniqueSlots = Associative Array( :Slot ) << get keys;
For( i = 1, i <= N Items( uniqueslots ), i++,
If( i == 1,
Dmaps = Eval("Dispatch( {}, \!"Graph Builder\!",FrameBox(" || Char( uniqueslots[i] ) || "),
{Background Map( Boundaries( \!"Wafer2\!" ) ), Marker Size( 3 ), Grid Line Order( 2 ),
Reference Line Order( 3 )})"
)
);
If( i < N Items( uniqueslots ),
Dmaps = Char( Dmaps ) || Eval(", Dispatch({}, \!"Graph Builder\!",FrameBox(" || Char( uniqueslots[i] ) || "),
{Background Map( Boundaries( \!"Wafer2\!" ) ), Marker Size( 3 ), Grid Line Order( 2 ),
Reference Line Order( 3 )})"
)
);
If( i == N Items( uniqueslots ),
Dmaps = Char( dmaps ) || Eval("Dispatch({}, \!"Graph Builder\!",FrameBox(" || Char( uniqueslots[i] ) || "),
{Background Map( Boundaries( \!"Wafer2\!" ) ), Marker Size( 3 ), Grid Line Order( 2 ),
Reference Line Order( 3 )})"
)
);
);
Show( dmaps );
Dscale = If( Contains( :SetupID[1], "0.026-0.2190um" ) > 0,
Parse( "[0.026 0.219]" ),
If( Contains( :SetupID[1], "0.026-0.2190umDSA" ) > 0,
Parse( "[0.026 0.219]" ),
If( Contains( :SetupID[1], "0.045-0.1421um" ) > 0,
Parse( "[0.045 0.1421]" ),
If( Contains( :SetupID[1], "0.046-0.1215um" ) > 0,
Parse( "[0.046 0.1215]" ),
If( Contains( :SetupID[1], "Post" ) > 0,
Parse( "[0.019 0.1297]" ),
If( Contains( :SetupID[1], "31-56.9nm" ) > 0,
Parse( "[0.031 0.0569]" )
)
)
)
)
)
);
Show( dscale );
script4 = Eval(
Parse(
"Graph Builder(
Size(
If( N Items( Associative Array( :Slot ) << get keys ) <= 16,
585,
1170
),
If( N Items( Associative Array( :Slot ) << get keys ) > 4,
50 * N Items( Associative Array( :Slot ) << get keys ) + Abs( 4 - Modulo( N Items( Associative Array( :Slot ) << get keys ), 4 ) ) /
4,
220
)
),
Show Control Panel( 0 ),
Show Footer( 0 ),
Continuous Color Theme( \!"Spectral\!" ),
Categorical Color Theme( \!"JMP Default\!" ),
Lock Scales( 1 ),
Title Fill Color( {221, 215, 204} ),
Title Frame Color( {221, 215, 204} ),
Level Fill Color( {233, 230, 226} ),
Level Frame Color( {221, 215, 204} ),
Variables(
X( :X ),
Y( :Y ),
Wrap(
:Slot,
Levels( N Items( Associative Array( :Slot ) << get keys ) ),
Levels per Row( If( N Items( Associative Array( :Slot ) << get keys ) <= 16, 4, 8 ) )
),
Overlay( :TIME ),
Color( :DSIZE )
),
Elements( Points( X, Y, Legend( 3 ) ) ),
SendToReport(
Dispatch(
{},
\!"X\!",
ScaleBox,
{Scale( \!"Geodesic\!" ), Min( -0.16 ), Max( 0.16 ), Inc( 0.05 ), Minor Ticks( 0 ), Label Row(
{Show Major Labels( 0 ), Show Major Ticks( 0 ), Show Minor Ticks( 0 )}
)}
),
Dispatch(
{},
\!"Y\!",
ScaleBox,
{Scale( \!"Geodesic\!" ), Format( \!"Best\!", 12 ), Min( -0.16 ), Max( 0.16 ), Inc( 0.05 ), Minor Ticks( 0 ),
Label Row( {Show Major Labels( 0 ), Show Major Ticks( 0 ), Show Minor Ticks( 0 )} )}
),
Dispatch(
{},
\!"400\!",
ScaleBox,
{Legend Model(
3,
Properties(
0,
{gradient(
{Color Theme( \!"Green Yellow Red\!" ), Scale Values(
"|| char(DScale) ||"
), Label Format( \!"Fixed Dec\!", 15, 3 ), N Labels( 5 )}
)}
)
)}
),
Dispatch( {}, \!"graph title\!", TextEditBox, {Set Text( :lot[1] )} ),
Dispatch( {}, \!"400\!", LegendBox, {Set Title( \!"\!" )} ),
"|| char(parse(Dmaps)) ||"));"
)
);
Re: Integration of a For loop generated string with Graph BuilderThanks, that code looks much cleaner.
I have sampel data attached along with the custom map files I (need to be pasted in C:\Program Files\SAS\JMP\13\Maps). With the script edits you made, I get a graph without any maps plus the following error:
Unexpected ",". Perhaps there is a missing ";" or ",".
Line 3 Column 32: ...ference Line Order( 3 )})►, Dispatch({}, "Graph Bui...
The remaining text that was ignored was
,Dispatch({}","Graph Builder,FrameBox(12),{Background Map(Boundaries"("Wafer2)),
Marker Size(3),Grid Line Order(2),Reference Line Order(3)}),Dispatch({}","
Graph Builder,FrameBox(13),{Background Map(Boundaries"("Wafer2)),Marker Size(3),
Grid Line Order(2),Reference Line Order(3)})Dispatch({}","Graph Builder,FrameBox(
14),{Background Map(Boundaries"("Wafer2)),Marker Size(3),Grid Line Order(2),
Reference Line Order(3)})
Cannot find FrameBox[ "Graph Builder" ] at {}
Graph Builder[]
Re: Integration of a For loop generated string with Graph BuilderI have examined your script, and without having some sample data to play with, it is tought to go further than I have.
I found one logic error, Your value of Dmaps will never end up with the value you set for the comparison of i == 1. That is because, the If clause folloing it will also execute when i == 1, for when i is equal to 1, it is also less than N Items( uniqueslots ).
I suggest the following code to restructure that code:
If(
i == 1,
Dmaps = Eval(
"Dispatch( {}, \!"Graph Builder\!",FrameBox(" || Char( uniqueslots[i] ) ||
"),
{Background Map( Boundaries( \!"Wafer2\!" ) ), Marker Size( 3 ), Grid Line Order( 2 ),
Reference Line Order( 3 )})"
),
i < N Items( uniqueslots ),
Dmaps = Char( Dmaps ) || Eval(
", Dispatch({}, \!"Graph Builder\!",FrameBox(" || Char( uniqueslots[i] ) ||
"),
{Background Map( Boundaries( \!"Wafer2\!" ) ), Marker Size( 3 ), Grid Line Order( 2 ),
Reference Line Order( 3 )})"
),
i == N Items( uniqueslots ),
Dmaps = Char( dmaps ) || Eval(
"Dispatch({}, \!"Graph Builder\!",FrameBox(" || Char( uniqueslots[i] ) ||
"),
{Background Map( Boundaries( \!"Wafer2\!" ) ), Marker Size( 3 ), Grid Line Order( 2 ),
Reference Line Order( 3 )})"
)
);
/*);
If( i < N Items( uniqueslots ),
Dmaps = Char( Dmaps ) || Eval(", Dispatch({}, \!"Graph Builder\!",FrameBox(" || Char( uniqueslots[i] ) || "),
{Background Map( Boundaries( \!"Wafer2\!" ) ), Marker Size( 3 ), Grid Line Order( 2 ),
Reference Line Order( 3 )})"
)
);
If( i == N Items( uniqueslots ),
Dmaps = Char( dmaps ) || Eval("Dispatch({}, \!"Graph Builder\!",FrameBox(" || Char( uniqueslots[i] ) || "),
{Background Map( Boundaries( \!"Wafer2\!" ) ), Marker Size( 3 ), Grid Line Order( 2 ),
Reference Line Order( 3 )})"
)
);*/
);
Likewise, you can get rid of all of your nested IFs in your second If structure with the following
Dscale = If(
Contains( :SetupID[1], "BareSiPre0.026-0.2190um" ) > 0, Parse( "[0.026 0.219]" ),
Contains( :SetupID[1], "BareSiPst0.026-0.2190umDSA" ) > 0, Parse( "[0.026 0.219]" ),
Contains( :SetupID[1], "LTALDOX300A0.045-0.1421umDSA" ) > 0, Parse( "[0.045 0.1421]" ),
Contains( :SetupID[1], "ALDOX2500A0.046-0.1215umDSA" ) > 0, Parse( "[0.046 0.1215]" ),
Contains( :SetupID[1], "BKM_BareSi_19nmPost_OHS" ) > 0, Parse( "[0.019 0.1297]" ),
Contains( :SetupID[1], "LTALDOx180A31-56.9nm" ) > 0,
Parse( "[0.031 0.0569]" )
/*If( Contains( :SetupID[1], "BareSiPst0.026-0.2190umDSA" ) > 0,
Parse( "[0.026 0.219]" ),
If( Contains( :SetupID[1], "LTALDOX300A0.045-0.1421umDSA" ) > 0,
Parse( "[0.045 0.1421]" ),
If( Contains( :SetupID[1], "ALDOX2500A0.046-0.1215umDSA" ) > 0,
Parse( "[0.046 0.1215]" ),
If( Contains( :SetupID[1], "BKM_BareSi_19nmPost_OHS" ) > 0,
Parse( "[0.019 0.1297]" ),
If( Contains( :SetupID[1], "LTALDOx180A31-56.9nm" ) > 0,
Parse( "[0.031 0.0569]" )
)
)
)
)
)*/
);