I was wondering about a script that did not do what it was supposed to do - not at all!!
Just open the attached data table and run the script: THE_BUG
Caption(
"column \!"File Name\!"
values: " || Char((current data table():file Name << Get values));
)
The result is surprising:
Why not "A" and "B" ?
One can easily fix the script ...
But digging deeper, there is a quite surprising root cause ...
please enjoy : )
I am confused. This is what I get using JMP 18.1.0:
Am I missing something?
Sorry, while updating the post, I accidentally removed the root cause.
Now the miracle works again ...
In the original data table you might have gotten
New Table("where_is_the_bug",
Add Rows(2),
Compress File When Saved(1),
New Script(
"THE BUG", JSL Quote(Caption(
"column \!"File Name\!"
name: "|| (current data table():file Name << Get Name)||"
values: " || Char((current data table():file Name << Get values));
)
) ,
As String(1)
),
New Column("File Name",
Character,
"Nominal",
Compact(),
Set Values({"A", "B"}),
Set Display Width(71)
),
New Column(["de" => "Dateiname", "en" => "File Name"],
Character,
"Nominal",
Compact(),
Set Selected,
Set Values({"C", "C"}),
Set Display Width(83)
)
)
Most definitely a bug considering JMP's rules for names but there are easy workarounds.More than a guess : )
It's interesting ...
As a consequence - a JSL code is very "fragile" if a column name is written slight different to the actual column name:
Somebody can add a new column with alternative values. If one of the localized names is similar to the original column name/ the reference in the script JMP will prioritize the new column. This can lead to surprising plots - maybe less obvious ones than this one:
<- Graph Builder will use this one
column name: weight
JSL script: Weight
alternative column (at the end of the table): wEiGhT <- Graph Builder will use this one
dt = Open("$SAMPLE_IMPORT_DATA/Bigclass.xlsx");
expr = Expr(dt << Graph Builder(
Size( 437, 413 ),
Graph Spacing( 4 ),
Variables( X( :height ), Y( :Weight ), Overlay( :sex ) ),
Elements( Points( X, Y, Legend( 1 ) ), Smoother( X, Y, Legend( 2 ) ) )
));
expr;
Wait(1);
caption("and with some magic ...");
New Column( ["x-id" => "wEiGhT", "en" => "innocent column"], Set Values( 100::61) );
expr;
Using the data table that @hogi supplied, it get the blank values that were originally shown. I then noticed that there is a column called File Name 2 that has blank values for the 2 rows. I then deleted the column File Name 2 and reran the script, and the script displayed
If you change the name of the column File Name 2 the script will also run correctly