I have two versions of the exact same JSL script to generate a variability chart, but one does not correctly display the chart. The formatting is all messed up. The only difference between the two versions is that one executes inside a for loop, the other doesn't. I see when I look at the output script, that they generate different internal scripts so that the one inside the for loop ignores a lot of my commands.
I attached the two versions of the script that I wrote, one shows the for loop (which is taking several parameters from a database and generating a variability chart for each), the other one is hard-coded. Also attached the scripts that JMP generates for these two different scripts. As you can see in WhatJMPdoesInstead.txt, it ignores a bunch of commands.
Anyone ever have this problem? Any way to fix this?
So two versions of exactly the same script except one works and one doesn't ... because, um ... they are not the same. So the problem isn't JMP but your code. It would help if you simplify the problem so that there isn't loads of code for us to look at and try and spot the difference ... and also if you could generate an illustration using a built-in JMP sample dataset then it's easier for people to help you without having access to your data. The fundamental problem is that you the way you are trying to substitute the column names into the script. In your loop you are using a variable whereas in the other you are using an actual column reference. JMP evaluates expressions from the outside working inwards (the opposite to most other languages) - hence at the time the Variability command is executed your variables don't have values. The solution is to defer the evaluation of the expression by using the EXPR function and constructing a representation of the command using either string manipulation or functions such as SUBSTITUTE. Here is a recent post that illustrates this ...
You are right, I just meant the flow of the code was the same. Obviously the for loop was there to handle multiple unique columns so I had to substitute for the name. It seemed to be handling all the other parameters fine so I didn't think I had to do anything special with the string.
Anyways I ended up creating the strings I needed outside the variability chart, then using expr(String1) inside the loop, and putting Eval( Exal Expr( ) ) around the entire variability chart, and it did what I wanted. Problem solved.