- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
funny issue with column names
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 : )
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Nasty issue with table names
I am confused. This is what I get using JMP 18.1.0:
Am I missing something?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Nasty issue with table names
Sorry, while updating the post, I accidentally removed the root cause.
Now the miracle works again ...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Nasty issue with table names
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.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Nasty issue with table names
More than a guess : )
It's interesting ...
- that JMP keeps the column name "File Name" internally for the second column - despite the conflict with the other column
just save the table script and you will see something like in @jthi 's post - that JMP uses this internal name to find the column - although the "File Name 2" in the table view
besides "file Name", you can also access the column via "File Name 2" - that JMP first scans the localized column names - and THEN the original column names (otherwise it would find the first column).
The sequence seems to be:
1) column name a: just exact matches
2) localized column names - even approximate matches
3) column name b: approximate matches - where the additional column came from.
I tried Concatenate and Update - with English and German settings ... with JMP 18.1 and JMP19EA4.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Nasty issue with table names
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;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Nasty issue with table names
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