BookmarkSubscribeRSS Feed
Choose Language Hide Translation Bar

JSL: using global variable in value ordering

hi folks, a quick question on JSL:
i am trying to use the value ordering function on scripts to update the order in each column, so that all the graphs will show the sequence i desire.

If i use the command below, it will work:
// update column 1's order to 1,2,3,4.
<< column("Column 1") << set property(value ordering,{"1","2","3","4"}); >>

But if i replace the list with a global variable below, it does not work:
// update column 1's order according to A.
<< A={"4","3","2","1"}; column("Column 1") << set property(value ordering,A); >>

It seems like a global variable is not accepted for the 'set property' function in JSL for both JMP7 and 8. Has anyone encountered the same problem?

Super User


Jun 23, 2011

Re: JSL: using global variable in value ordering

Try Eval(A) as the second argument instead of just A.

A little off topic: JSL is a great tool, but it takes a lot of trial and error to write a script. In this example A and Eval(A) alone yields exactly the same result in the log window. But internally they obviously represent different things for the JSL interpreter.

The rules for when arguments can be represented by variables, expressions, quoted strings etc. is confusing, as is the rules for when eval(), parse(), nameexpr() et al must be used. In some situations several different alternatives work equally well, in other JSL is very picky. There is probably a sound logic behind everything from developers point of view, but as a user I wish JSL was more intuitive in these respects. An improved debugging tool could also help in that area.

Re: JSL: using global variable in value ordering

hi MS,
it does work! I'm still a newbie in JSL and your 'off topic' is very sightful to my learning. Thanks alot! :)