cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Try the Materials Informatics Toolkit, which is designed to easily handle SMILES data. This and other helpful add-ins are available in the JMPÂź Marketplace
Choose Language Hide Translation Bar
terapin
Level VI

Enhanced Log - n added after "column name"

Folks,

 

In utilizing the Enhanced log with data tables that have long, descriptive column names, the output is placing a "n" after the variable name as shown in some examples below.  Normally, the "n" isn't produced when the column name is short and doesn't include non-alphabetical characters such as & or ,.  While the Enhanced Log code will run with these additional characters, I'd like to better understand why the "n" is produced and whether I should keep them as part of my code or remove them?

 

// Select where
Data Table( "PESD Stationary, Envidas SQL Data Table, 1-Min" ) <<
Select where( :"Ambient NOx, N500 Status"n == 31 );


// Subset data table
Data Table( "PESD Stationary, Envidas SQL Data Table, 1-Min" ) << Subset(
	Selected Rows( 1 ),
	columns(
		:"Date & Time"n, :Date, :Day of Year, :"Ambient NO, N500 (ppb)"n,
		:"Ambient NO, N500 Status"n, :"Ambient NO2, N500 (ppb)"n,
		:"Ambient NO2, N500 Status"n, :"Ambient NOx, N500 (ppb)"n,
		:"Ambient NOx, N500 Status"n
	)
);

1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: Enhanced Log - n added after "column name"

In addition to txnelson's explanation, here is one link related to "col name"n syntax as you might see Name() syntax in older scripts Deprecating the Name() parser directive in JMP 16 and JMP Help - Scripting Guide - Names 

-Jarmo

View solution in original post

8 REPLIES 8
txnelson
Super User

Re: Enhanced Log - n added after "column name"

The "xxxxxxx"n version of the column name is produced when JMP determines that if the actual column name will not parse correctly in open code.  The easiest way to demonstrate this, is with the following example.

If a variable is named "X-Y" and one wants to create a new variable using that column, and with it, add it to the variable Z, the JSL would be

newVar = X - Y + Z;

JMP would be looking for a variable named X, a variable named Y and a variable named  Z.  Basically, JMP would get confused.

newVar = "X - Y"n + Z;

clarifies the situation.

Jim
terapin
Level VI

Re: Enhanced Log - n added after "column name"

Not sure I completely understand given that I'm scoping my column names such as :"Column Name, Column Units".  With the column scoping ( : ) I would think JMP wouldn't get confused whether I was working with a variable vs a column name.  

txnelson
Super User

Re: Enhanced Log - n added after "column name"

JMP does not know how you are going to use the column names.  So it is playing it safe, in that when it comes across a column name that "could" be confusing, it converts to the :xxxxxxx"n format.  And in turn, it is wise for you to use it when you see that it might be confusing, even if is some cases, you might get away without a problem.

Jim
jthi
Super User

Re: Enhanced Log - n added after "column name"

In addition to txnelson's explanation, here is one link related to "col name"n syntax as you might see Name() syntax in older scripts Deprecating the Name() parser directive in JMP 16 and JMP Help - Scripting Guide - Names 

-Jarmo
terapin
Level VI

Re: Enhanced Log - n added after "column name"

Thanks txnelson and jthi for your input,

 

Ironically, after reading txnelson's latest reply and digging around some more on the Discussion board, I stumbled on the following link in which jthi described the deprecation of the Name() parser (https://community.jmp.com/t5/Discussions/Using-new-Name-nomenclature-with-variable/m-p/365431).  Sorry to have missed that subtle adjustment in the switch from version 15 to 16. Thanks folks for helping resolve this.

lazzybug
Level III

Re: Enhanced Log - n added after "column name"

@txnelson @jthi could you please help me convert the list below into another list? I cannot replace " with \!" code easily. I was stuck here, thank you so much for your help.

 

factors = {"Kilometer (kg)"n, "Temperature (ÂșC)"n};

 

 

 

factors = {\!"Kilometer (kg)\!"n, \!"Temperature (ÂșC)\!"n};

 

  The reason to convert the list because once I pick the items from factors and tried to combine with other string, the " and n disappeared, which caused trouble for my code. If I can have the second list, it won't have any problems.

 

for example:

factors = {"Kilometer (kg)"n, "Temperature (ÂșC)"n};
responses_sim = "";
values = {1.23,2.34};
for (i=1, i<=N Items(factors), i++,
	responses_sim = responses_sim || factors[i] || "<< Add Random Noise(" || char(values[i]) || "),"
);

show(responses_sim);

responses_sim = "Kilometer (kg)<< Add Random Noise(1.23),Temperature (ÂșC)<< Add Random Noise(2.34),";
I want to get this result below, how to do it?
responses_sim = "Kilometer (kg)"n << Add Random Noise(1.23), "Temperature (ÂșC)"n << Add Random Noise(2.34),"
jthi
Super User

Re: Enhanced Log - n added after "column name"

I would most likely try to build this without using strings (depending what you are doing), but:

Names Default To Here(1);

factors = {"Kilometer (kg)"n, "Temperature (ÂșC)"n};
responses_sim = "";
values = {1.23,2.34};

for (i=1, i<=N Items(factors), i++,
	responses_sim = responses_sim || Eval Insert("\[^factors[i]^ << Add Random Noise(^values[i]^),]\");
);
responses_sim ||= "\!"";

write(responses_sim);
//show(responses_sim);
//responses_sim = "Kilometer (kg)"n << Add Random Noise(1.23), "Temperature (ÂșC)"n << Add Random Noise(2.34),"
-Jarmo
lazzybug
Level III

Re: Enhanced Log - n added after "column name"

@jthi Thank you so much for your help. I will use this script to simulate responses automatically