<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Inconsistent acceptable syntax in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Inconsistent-acceptable-syntax/m-p/813124#M99417</link>
    <description>&lt;P&gt;Thanks Craige.&lt;/P&gt;&lt;P&gt;The error message is:&lt;/P&gt;&lt;P&gt;Name Unresolved: 2PCS_X(um) at row 1 in access or evaluation of '2PCS_X(um)' , "2PCS_X(um)"n /*###*/&lt;/P&gt;&lt;P&gt;"2PCS_X(um)" is the name of the first column to be evaluated.&lt;/P&gt;&lt;P&gt;So the expression for the first column is supposed to be:&lt;/P&gt;&lt;P&gt;newcol = dtTOSA &amp;lt;&amp;lt; new column("Temp", numeric, formula(Num( :"2PCS_X(um)"n )));&lt;/P&gt;</description>
    <pubDate>Thu, 14 Nov 2024 20:38:41 GMT</pubDate>
    <dc:creator>pcarroll1</dc:creator>
    <dc:date>2024-11-14T20:38:41Z</dc:date>
    <item>
      <title>Inconsistent acceptable syntax</title>
      <link>https://community.jmp.com/t5/Discussions/Inconsistent-acceptable-syntax/m-p/813072#M99408</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;AllCols = dt &amp;lt;&amp;lt; Get Column Names();
AllColNames = dt &amp;lt;&amp;lt; Get Column Names(string);
for(i=3, i&amp;lt;=n items(AllCols), i++, 
	colcol = AllCols[i];
	cname = AllColNames[i];
	nnm1 = Col Number(colcol);
	Fstr = "num(:\!""||cname||"\!"n)";
	Fexpr = parse(Fstr);
	newcol = dt &amp;lt;&amp;lt; new column("Temp", numeric, formula(eval(evalexpr(Fexpr))));
	nnm2 = Col Number(newcol);
	if(nnm2 == nnm1, 
		newcol &amp;lt;&amp;lt; delete formula();
		dt &amp;lt;&amp;lt; Delete Columns(colcol);
		newcol &amp;lt;&amp;lt; set name(cname),  //else
		dt &amp;lt;&amp;lt; Delete Columns(newcol);
	);
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I am using JMP18 on Windows.&amp;nbsp; When I write code that I want to use often, I like to make a toolbar button for it.&amp;nbsp; But sometimes I find that code that is acceptable to run from an open script window is not acceptable when run from a toolbar icon.&amp;nbsp; Here is an example, where I am looping through columns and changing them from character to numeric if all entries are numeric.&amp;nbsp; When running from a toolbar the objection is for the line:&lt;/P&gt;&lt;P&gt;&lt;CODE class=" language-jsl"&gt;newcol = dt &amp;lt;&amp;lt; new column("Temp", numeric, formula(eval(evalexpr(Fexpr))));&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;This syntax is acceptable when I run from a script window!&lt;/P&gt;&lt;P&gt;Why would the jsl interpreter be different in each situation?&lt;/P&gt;&lt;P&gt;What syntax for this would be universally acceptable?&lt;/P&gt;&lt;P&gt;For very large datasets and columns this can be slow.&amp;nbsp; Is there a better way to do this?&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Nov 2024 16:08:57 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Inconsistent-acceptable-syntax/m-p/813072#M99408</guid>
      <dc:creator>pcarroll1</dc:creator>
      <dc:date>2024-11-14T16:08:57Z</dc:date>
    </item>
    <item>
      <title>Re: Inconsistent acceptable syntax</title>
      <link>https://community.jmp.com/t5/Discussions/Inconsistent-acceptable-syntax/m-p/813083#M99409</link>
      <description>&lt;P&gt;What error message did you get? I think the script window has a current data table but the toolbar script may not. Maybe just adding&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;currentDatatable(dt);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;at the start of the script would be enough.&lt;/P&gt;
&lt;P&gt;You could&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;print(currentDatatable());&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;at the start of the script to find out what the toolbar script knows.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Nov 2024 16:39:01 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Inconsistent-acceptable-syntax/m-p/813083#M99409</guid>
      <dc:creator>Craige_Hales</dc:creator>
      <dc:date>2024-11-14T16:39:01Z</dc:date>
    </item>
    <item>
      <title>Re: Inconsistent acceptable syntax</title>
      <link>https://community.jmp.com/t5/Discussions/Inconsistent-acceptable-syntax/m-p/813085#M99410</link>
      <description>&lt;P&gt;Toolbars might be adding Names Default To Here(1) (which I say you should always have) to your script&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_0-1731602218857.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/70160i87532DD38BAF6D71/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_0-1731602218857.png" alt="jthi_0-1731602218857.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;which can then potentially show some errors which wouldn't be visible if everything is in global scope (but still they are usually errors). I build my formulas using either Eval(EvalExpr()) or Eval(Substitute())&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Eval(EvalExpr(
	newcol = dt &amp;lt;&amp;lt; New Column("Temp", numeric, formula(Num(Expr(NameExpr(AsColumn(dt, i))))));
));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;For large datasets you might have to consider sampling for something like this.There are also non-formula solutions which might be faster but it might also depend on your data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For some reason I haven't published this to JMP community (or atleast I couldn't find it), &lt;A href="https://github.com/jthi-jmp-tools/character-columns-to-numeric" target="_self"&gt;Character Columns to Numeric (github.com)&lt;/A&gt; , you can take a look at the code to see how I have performed this task from &lt;A href="https://github.com/jthi-jmp-tools/character-columns-to-numeric/blob/main/bin/bin/character_columns_to_numeric.jsl" target="_blank"&gt;https://github.com/jthi-jmp-tools/character-columns-to-numeric/blob/main/bin/bin/character_columns_to_numeric.jsl&lt;/A&gt;. I have since redone this script and if I remember correctly I do use a bit different method nowadays.&lt;/P&gt;</description>
      <pubDate>Thu, 14 Nov 2024 16:49:08 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Inconsistent-acceptable-syntax/m-p/813085#M99410</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2024-11-14T16:49:08Z</dc:date>
    </item>
    <item>
      <title>Re: Inconsistent acceptable syntax</title>
      <link>https://community.jmp.com/t5/Discussions/Inconsistent-acceptable-syntax/m-p/813090#M99412</link>
      <description>&lt;P&gt;toolbar icons know the&amp;nbsp;&lt;FONT face="courier new,courier"&gt; current data table():&lt;BR /&gt;The problem is rather the inverse one.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;Please&amp;nbsp; define "dt=current data table()" before the&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt &amp;lt;&amp;lt; Get Column Names();&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Nov 2024 18:08:53 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Inconsistent-acceptable-syntax/m-p/813090#M99412</guid>
      <dc:creator>hogi</dc:creator>
      <dc:date>2024-11-14T18:08:53Z</dc:date>
    </item>
    <item>
      <title>Re: Inconsistent acceptable syntax</title>
      <link>https://community.jmp.com/t5/Discussions/Inconsistent-acceptable-syntax/m-p/813124#M99417</link>
      <description>&lt;P&gt;Thanks Craige.&lt;/P&gt;&lt;P&gt;The error message is:&lt;/P&gt;&lt;P&gt;Name Unresolved: 2PCS_X(um) at row 1 in access or evaluation of '2PCS_X(um)' , "2PCS_X(um)"n /*###*/&lt;/P&gt;&lt;P&gt;"2PCS_X(um)" is the name of the first column to be evaluated.&lt;/P&gt;&lt;P&gt;So the expression for the first column is supposed to be:&lt;/P&gt;&lt;P&gt;newcol = dtTOSA &amp;lt;&amp;lt; new column("Temp", numeric, formula(Num( :"2PCS_X(um)"n )));&lt;/P&gt;</description>
      <pubDate>Thu, 14 Nov 2024 20:38:41 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Inconsistent-acceptable-syntax/m-p/813124#M99417</guid>
      <dc:creator>pcarroll1</dc:creator>
      <dc:date>2024-11-14T20:38:41Z</dc:date>
    </item>
    <item>
      <title>Re: Inconsistent acceptable syntax</title>
      <link>https://community.jmp.com/t5/Discussions/Inconsistent-acceptable-syntax/m-p/813136#M99419</link>
      <description>&lt;P&gt;Also, in the actual script I don't use dt as a variable.&amp;nbsp; I use a much more descriptive variable, like dtTOSA. (see above)&amp;nbsp; Everytime I want to address a particular data table I always explicitly state it to avoid confusion, as I did in this statement.&amp;nbsp; I don't see how the interpreter could think I'm referring to a different table.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Nov 2024 21:01:40 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Inconsistent-acceptable-syntax/m-p/813136#M99419</guid>
      <dc:creator>pcarroll1</dc:creator>
      <dc:date>2024-11-14T21:01:40Z</dc:date>
    </item>
    <item>
      <title>Re: Inconsistent acceptable syntax</title>
      <link>https://community.jmp.com/t5/Discussions/Inconsistent-acceptable-syntax/m-p/813158#M99423</link>
      <description>&lt;P&gt;Maybe, but the error message suggests JMP is not looking in the right place for "2PCS_X(um)"n. I'm not sure what context the toolbar script can use.&lt;/P&gt;</description>
      <pubDate>Thu, 14 Nov 2024 23:35:15 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Inconsistent-acceptable-syntax/m-p/813158#M99423</guid>
      <dc:creator>Craige_Hales</dc:creator>
      <dc:date>2024-11-14T23:35:15Z</dc:date>
    </item>
    <item>
      <title>Re: Inconsistent acceptable syntax</title>
      <link>https://community.jmp.com/t5/Discussions/Inconsistent-acceptable-syntax/m-p/813344#M99444</link>
      <description>&lt;P&gt;Craige,&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;I used your suggestion of using a print statement and found that it never got to the line I thought was the problem.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;newcol = dt &amp;lt;&amp;lt; new column("Temp", numeric, formula(eval(evalexpr(Fexpr))));&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;SPAN class=""&gt;The problem was at this line.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;nnm1 = Col Number(colcol);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;SPAN class=""&gt;So I changed it to this and that worked.&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;nnm1 = dtTOSA &amp;lt;&amp;lt; Col Number(colcol);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;SPAN class=""&gt;&amp;nbsp;I found that I also needed to remind JMP again what the current table was later in the code and I had to use {} in Delete Columns before it worked. For some reason JMP doesn't care if those curly brackets are there if run from a script window.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;The code snippet is now this.&amp;nbsp; By the way this is a snippet of a longer code that also creates this and another table.&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;AllCols = dtTOSA &amp;lt;&amp;lt; Get Column Names();
AllColNames = dtTOSA &amp;lt;&amp;lt; Get Column Names(string);
currentDatatable(dtTOSA);
for(i=3, i&amp;lt;=n items(AllCols), i++, 
	colcol = AllCols[i];
	cname = AllColNames[i];
	nnm1 = dtTOSA &amp;lt;&amp;lt; Col Number(colcol);
	Fstr = "num(:\!""||cname||"\!"n)";
	Fexpr = parse(Fstr);
	newcol = dtTOSA &amp;lt;&amp;lt; new column("Temp", numeric, set formula(eval(evalexpr(Fexpr))));
	nnm2 = dtTOSA &amp;lt;&amp;lt; Col Number(newcol);
	if(nnm2 == nnm1, 
		currentDatatable(dtTOSA);
		newcol &amp;lt;&amp;lt; delete formula();
		dtTOSA &amp;lt;&amp;lt; Delete Columns({colcol});
		wait(0);
		newcol &amp;lt;&amp;lt; set name(cname),  //else
		dtTOSA &amp;lt;&amp;lt; Delete Columns({newcol});
	);
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;SPAN class=""&gt;However, now there is a different problem.&amp;nbsp; Even though, I delete the old column before renaming the new column, JMP puts an unwanted 2 after the column name!&amp;nbsp; Again it does not do this running from a script window.&amp;nbsp;I tried including a wait(0) statement but that didn't help.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;How can this be fixed?&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Nov 2024 15:14:02 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Inconsistent-acceptable-syntax/m-p/813344#M99444</guid>
      <dc:creator>pcarroll1</dc:creator>
      <dc:date>2024-11-15T15:14:02Z</dc:date>
    </item>
    <item>
      <title>Re: Inconsistent acceptable syntax</title>
      <link>https://community.jmp.com/t5/Discussions/Inconsistent-acceptable-syntax/m-p/813346#M99445</link>
      <description>&lt;P&gt;Actually, it is not performing the delete column operation.&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dtTOSA &amp;lt;&amp;lt; Delete Columns({colcol});&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;So it's keeping the original character column and the new numeric column.&lt;/P&gt;</description>
      <pubDate>Fri, 15 Nov 2024 15:28:07 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Inconsistent-acceptable-syntax/m-p/813346#M99445</guid>
      <dc:creator>pcarroll1</dc:creator>
      <dc:date>2024-11-15T15:28:07Z</dc:date>
    </item>
    <item>
      <title>Re: Inconsistent acceptable syntax</title>
      <link>https://community.jmp.com/t5/Discussions/Inconsistent-acceptable-syntax/m-p/813347#M99446</link>
      <description>&lt;P&gt;Strangely, if it goes to the "else" condition that delete statement works fine.&lt;/P&gt;</description>
      <pubDate>Fri, 15 Nov 2024 15:29:43 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Inconsistent-acceptable-syntax/m-p/813347#M99446</guid>
      <dc:creator>pcarroll1</dc:creator>
      <dc:date>2024-11-15T15:29:43Z</dc:date>
    </item>
    <item>
      <title>Re: Inconsistent acceptable syntax</title>
      <link>https://community.jmp.com/t5/Discussions/Inconsistent-acceptable-syntax/m-p/813357#M99449</link>
      <description>&lt;P&gt;&amp;nbsp;Although, the column is referred to in 2 different ways (one as the text string name, the other as a column type) this finally worked.&amp;nbsp; I've been writing code in jsl for 18 years and still find referencing columns as variables in jsl to be inconsistent and confusing.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;AllCols = dtTOSA &amp;lt;&amp;lt; Get Column Names();
AllColNames = dtTOSA &amp;lt;&amp;lt; Get Column Names(string);
currentDatatable(dtTOSA);
for(i=3, i&amp;lt;=n items(AllCols), i++, 
	colcol = AllCols[i];
	cname = AllColNames[i];
	nnm1 = dtTOSA &amp;lt;&amp;lt; Col Number(colcol);
	Fstr = "num(:\!""||cname||"\!"n)";
	Fexpr = parse(Fstr);
	newcol = dtTOSA &amp;lt;&amp;lt; new column("Temp", numeric, set formula(eval(evalexpr(Fexpr))));
	nnm2 = dtTOSA &amp;lt;&amp;lt; Col Number(newcol);
	if(nnm2 == nnm1, 
		currentDatatable(dtTOSA);
		newcol &amp;lt;&amp;lt; delete formula();
		dtTOSA &amp;lt;&amp;lt; Delete Columns(eval(cname));
		currentDatatable(dtTOSA);
		newcol &amp;lt;&amp;lt; set name(cname),  //else
		dtTOSA &amp;lt;&amp;lt; Delete Columns({newcol});
	);
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 15 Nov 2024 16:22:59 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Inconsistent-acceptable-syntax/m-p/813357#M99449</guid>
      <dc:creator>pcarroll1</dc:creator>
      <dc:date>2024-11-15T16:22:59Z</dc:date>
    </item>
    <item>
      <title>Re: Inconsistent acceptable syntax</title>
      <link>https://community.jmp.com/t5/Discussions/Inconsistent-acceptable-syntax/m-p/813360#M99451</link>
      <description>&lt;P&gt;I always use strings as my column base and then build my references from them how ever I need. I have found this to be the most flexible way of handling different types of referencing.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For example, if I take your script and make some assumptions of its purpose (starting from third column go through all of them, create a new formula column in which you change values to numeric, compare missing values and perform actions based on the result) I would write it like this in JMP18:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

dtTOSA = New Table("Untitled",
	Add Rows(4),
	Compress File When Saved(1),
	New Column("Column 1",
		Numeric,
		"Continuous",
		Format("Best", 12),
		Set Values([1, 2, 3, 4])
	),
	New Column("Column 2", Character, "Nominal", Set Values({"A", "1", "2", "3"})),
	New Column("Column 3", Character, "Nominal", Set Values({"1", "2", "3", "4"})),
	New Column("Column 4", Character, "Nominal", Set Values({"A", "B", "C", "D"}))
);
wait(1); // demo purposes

cols = dtTOSA &amp;lt;&amp;lt; Get Column Names("String");
// Remove From(cols, 1, 2); // skipping this for demo purposes

For Each({colname}, cols,
	// colname = cols[3]; // for testing
	Eval(EvalExpr(
		newcol = dtTOSA &amp;lt;&amp;lt; New Column("Temp", numeric, Formula(
			Num(Expr(Name Expr(As Column(dtTOSA, colname))))
		));
	));
	newcol &amp;lt;&amp;lt; Run Formulas;
	newcol &amp;lt;&amp;lt; delete formula();
	
	orig_vals = Col Number(Column(dtTOSA, colname));
	new_vals = Col Number(Column(dtTOSA, (newcol &amp;lt;&amp;lt; get name)));
	
	If(orig_vals == new_vals,
		dtTOSA &amp;lt;&amp;lt; Delete Columns(colname);
		newcol &amp;lt;&amp;lt; set name(colname);
	, 
		dtTOSA &amp;lt;&amp;lt; Delete Columns(newcol)
	);
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And if I were to do this from the beginning but still using a bit similar idea as you have, I would (at least at this second) do something like this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

dt = New Table("Untitled",
	Add Rows(4),
	Compress File When Saved(1),
	New Column("Column 1",
		Numeric,
		"Continuous",
		Format("Best", 12),
		Set Values([1, 2, 3, 4])
	),
	New Column("Column 2", Character, "Nominal", Set Values({"A", "1", "2", "3"})),
	New Column("Column 3", Character, "Nominal", Set Values({"1", "2", "3", "4"})),
	New Column("Column 4", Character, "Nominal", Set Values({"A", "B", "C", "D"}))
);
wait(1); // demo purposes

cols = dt &amp;lt;&amp;lt; Get Column Names("Character", "String"); // We only need to check character columns

For Each({colname}, cols,
	dt_summary = dt &amp;lt;&amp;lt; Summary(
		Group(Eval(colname)),
		Freq("None"),
		Weight("None"),
		Link to original data table(0),
		output table name("Summar of " || colname),
		Private
	);
	
	orig_vals = Col Number(Column(dt_summary, 1));
	Column(dt_summary, 1) &amp;lt;&amp;lt; Set Data Type("Numeric");
	new_vals = Col Number(Column(dt_summary, 1));
	Close(dt_summary, no save);
	
	If(orig_vals == new_vals, // we can change
		Column(dt, colname) &amp;lt;&amp;lt; Set Data Type("Numeric");
		Column(dt, colname) &amp;lt;&amp;lt; Set Modeling Type("Continuous");
	);
);
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I tend to do these utilizing Transform Each and Num, but sometimes it might be enough if you let JMP do the conversions (there are case where you might not want to do this though..., see Num() from scripting index and how it behaves with Num("5%") for example. &amp;lt;&amp;lt; Restrict avoids this behaviour)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Nov 2024 17:00:04 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Inconsistent-acceptable-syntax/m-p/813360#M99451</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2024-11-15T17:00:04Z</dc:date>
    </item>
    <item>
      <title>Re: Inconsistent acceptable syntax</title>
      <link>https://community.jmp.com/t5/Discussions/Inconsistent-acceptable-syntax/m-p/813400#M99457</link>
      <description>&lt;P&gt;Jarmo,&lt;/P&gt;&lt;P&gt;Thanks for the thoughts.&amp;nbsp; I sometimes have thousands of columns, and tens of thousands of rows, and speed can be an issue.&amp;nbsp; The way I do it now actually reduced the time to ~1/3 of the way I did this previously, but that still can be many minutes.&amp;nbsp; I could experiment with your method sometime, but I wonder if you think making a summary table each time would be slower or faster.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regarding dealing with columns references, I've tried using Column(dt, colname) but it doesn't always work.&amp;nbsp; But in your script you also use As Column().&amp;nbsp; As a rule, is As Column() used for formulas?&lt;/P&gt;</description>
      <pubDate>Fri, 15 Nov 2024 19:11:45 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Inconsistent-acceptable-syntax/m-p/813400#M99457</guid>
      <dc:creator>pcarroll1</dc:creator>
      <dc:date>2024-11-15T19:11:45Z</dc:date>
    </item>
    <item>
      <title>Re: Inconsistent acceptable syntax</title>
      <link>https://community.jmp.com/t5/Discussions/Inconsistent-acceptable-syntax/m-p/813401#M99458</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/3991"&gt;@pcarroll1&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;P&gt;As a rule, is As Column() used for formulas?&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;yes, either &lt;FONT face="courier new,courier"&gt;as column(columnname)&lt;/FONT&gt; or &lt;FONT face="courier new,courier"&gt;:column(dt, columnname)[]&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Nov 2024 19:31:27 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Inconsistent-acceptable-syntax/m-p/813401#M99458</guid>
      <dc:creator>hogi</dc:creator>
      <dc:date>2024-11-15T19:31:27Z</dc:date>
    </item>
    <item>
      <title>Re: Inconsistent acceptable syntax</title>
      <link>https://community.jmp.com/t5/Discussions/Inconsistent-acceptable-syntax/m-p/813417#M99462</link>
      <description>&lt;P&gt;For first "question": if you try to optimize for speed for specific use cases, you just have to try out which works best as there are many different methods and the fastest might depend a lot on your data. In this case I used summary table (or Summarize) to avoid checking for replicate values but it like I mentioned, depends on your data, on your JMP versions, and possibly on other things...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For column references; &lt;STRONG&gt;my rule is: always use column name and table reference as the starting point, and build the final reference from them&lt;/STRONG&gt;. What I consider a &lt;STRONG&gt;reference&lt;/STRONG&gt; depends &lt;STRONG&gt;where&lt;/STRONG&gt; and &lt;STRONG&gt;how &lt;/STRONG&gt;I'm using it. For example if I'm building a formula I want to have my formula to reference columns as :mycol (and not AsColumn(mycol) or Column(mycol)[], which are usually also fine). And I can get the :mycol format using the fairly long style of NameExpr(AsColumn(dt,colname)) with expression evaluation. Generally AsColumn(dt, colname) (OR dt:colname) is the same as Column(dt, colname)[Row()] (or Column(dt, colname)[]), which will get the value of &lt;STRONG&gt;current row&amp;nbsp;&lt;/STRONG&gt;(in my &lt;STRONG&gt;mind&lt;/STRONG&gt; this isn't always like this. For example in platforms I consider :mycol being a reference instead of a specific value on a row...).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As an example this will return missing value as mycol will be &lt;STRONG&gt;evaluated immediately&lt;/STRONG&gt; and the initial Row() value is 0 in JMP&amp;nbsp; (not an issue inside a formula as the Row() will be updated all the time)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1); 

dt = open("$SAMPLE_DATA/Big Class.jmp");
colname = "age";

mycol = NameExpr(AsColumn(dt,colname));

show(mycol)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is the most difficult difference to understand with column references, &lt;STRONG&gt;As Column() (value of the current row)&lt;/STRONG&gt; vs &lt;STRONG&gt;Column() (reference to a column)&lt;/STRONG&gt; in JMP. It is very difficult to get your head around how these work... I have learned it basically by failing many many times. And now I have a good idea which to use initially when building an expression (I might still be incorrect from time to time). This topic is something I wish to write a blog post at some point as my opinions (currently) might differ from others and I consider myself pretty good JMP scripter without being a JMP (JSL) developer.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;One thing to note here&lt;/STRONG&gt;: I'm not a JMP developer and I don't really even care how developers think JSL works (I do disagree from time to time with developers). All my answers are always based &lt;STRONG&gt;on my experiences&lt;/STRONG&gt; with the JMP versions I have used. &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm very sorry if this post is bit confusing (I might have had few beers this evening :)&lt;/img&gt; ). If you wish to have more explanation on my opinions on this topics, you can post to this topic (but tag me with @ so I will notice it more easily). You can also send me a private message if necessary.&lt;/P&gt;</description>
      <pubDate>Fri, 15 Nov 2024 20:18:25 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Inconsistent-acceptable-syntax/m-p/813417#M99462</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2024-11-15T20:18:25Z</dc:date>
    </item>
  </channel>
</rss>

