cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Check out the JMP® Marketplace featured Capability Explorer add-in
Choose Language Hide Translation Bar
hogi
Level XII

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:

hogi_0-1732126833528.png

 

Why not "A" and "B" ? 

hogi_0-1732127013623.png

 



One can easily fix the script ...

But digging deeper, there is a quite surprising root cause ...

please enjoy : )

6 REPLIES 6

Re: Nasty issue with table names

I am confused. This is what I get using JMP 18.1.0:

 

Dan_Obermiller_0-1732127389036.png

 

Am I missing something?

Dan Obermiller
hogi
Level XII

Re: Nasty issue with table names

Sorry, while updating the post, I accidentally removed the root cause.

Now the miracle works again ...

jthi
Super User

Re: Nasty issue with table names

In the original data table you might have gotten

jthi_0-1732127862902.png

 

View more...
My guess is that it is caused by using translated column name and same name in other column + relying on JMP's loose name rules (file Name instead of File Name for column referencing)
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.
-Jarmo
hogi
Level XII

Re: Nasty issue with table names

More than a guess : )

It's interesting ...

  1. 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
  2. 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"
  3. 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
  4. where the additional column came from.
    I tried Concatenate and Update - with English and German settings ... with JMP 18.1 and JMP19EA4.

 

hogi
Level XII

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 

hogi_0-1732136728576.png

 

 

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;

  

txnelson
Super User

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 

txnelson_0-1732139464854.png

If you change the name of the column File Name 2 the script will also run correctly

Jim