BookmarkSubscribeRSS Feed
teresa

Community Trekker

Joined:

Jun 23, 2011

Learning to work with Lists

Hello friends,

I am new scripting with list, but I know the powerful they have.
I would like to take profit of that, but I need your help.

I try to do several identical graphs. The only think it changes is the variables to graph.

I create a list with the names of the variables I would like to display in one graph, a I try to use the list to make an easy change script. I only replace the column names by the elements of the list, but I think that perhaps there is another way to simplify my scripting.

Here is my scripting I would like to reduce using the power of list:

Can anyone help me?


VARS={"P04_02", "P04_05", "P04_06", "P04_04"};

gb=New Window("Grafico-02",
Graph Builder(
Size( 569, 500 ),
Show Control Panel( 0 ),
Variables(
X( :año ),
Y( Column(VARS[1]), Size( 0, 17 ) ),
Y( Column(VARS[2]), Position( 1 ), Size( 0, 17 ) ),
Y( Column(VARS[3]), Position( 1 ), Size( 0, 17 ) ),
Y( Column(VARS[4]), Position( 1 ), Size( 0, 17 ) )
),
Elements(
Line(
X,
Y( 1 ),
Y( 2 ),
Y( 3 ),
Y( 4 ),
Legend( 3 ),
Row order( 0 ),
Summary Statistic( "Mean" )
)
),
SendToReport(
Dispatch(
{},
VARS[1],
ScaleBox,
{Format( "Best", 10 ), Add Ref Line( 9, Dotted, "Black" ),
Add Ref Line( 8, Dotted, "Black" ), Add Ref Line( 7, Dotted, "Black" )}
),
Dispatch(
{},
"400",
ScaleBox,
{Legend Model(
3,
Level Name( 0, char(column(VARS[1])< Level Name( 1, char(column(VARS[2])< Level Name( 2, char(column(VARS[3])< Level Name( 3, char(column(VARS[4])< Properties( 0, {Fill Color( 1 )} ),
Properties( 1, {Fill Color( 2 )} ),
Properties( 2, {Fill Color( 3 )} ),
Properties( 3, {Fill Color( 4 )} )
)}
),
Dispatch( {}, "400", LegendBox, {Set Title( "Item evaluat:" )} )
)
)
);

Message was edited by: Teresa
3 REPLIES

Re: Learning to work with Lists

I'm trying to post a reply including a small JSL script to the above, but find I'm unable to do so, even though I'm putting it inside HTML-style comments as recommended in an earlier thread (JJones, 6th March 2009). Am I using the correct symbols here, please?



Many thanks

Message was edited by: David Q/R
mpb

Super User

Joined:

Jun 23, 2011

Re: Learning to work with Lists

To maintain spacing you might try

Square brackets in code seem to cause problems. You may be able to overcome them by typing

&amp#91; for left square bracket and
&amp#93; for right square bracket (note the semi colon for both)

Re: Learning to work with Lists

Hi Teresa,

I'm not absolutely certain I'm clear on what you want to do here, but if it is to plot a chart with an interactive selection from a list of Y variables, the following script might help show how that could be done (though I'm sure there are easier ways):