<?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: Referencing a Column in JSL in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Referencing-a-Column-in-JSL/m-p/395869#M64655</link>
    <description>&lt;P&gt;If I remember correctly using dt:"colname" (same as you would use As Column()) will get you direct access to current&amp;nbsp;value of the current Row() of the column named "colname" in datatable with reference dt. To get a reference to column you can use Column(dt, "colname") as &lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/11634"&gt;@Thierry_S&lt;/a&gt; said.&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(5),
	Compress File When Saved(1),
	New Column("Column Title/Name",
		Character,
		"Nominal",
		Set Values({"a1", "b2", "c3", "d4", ""})
	)
);
For each row(dt,
	col = dt:"Column Title/Name";
	Show(col);	
);

Row() = 1;
col = AsColumn(dt, "Column Title/Name");
Show(col);

col = Column(dt, "Column Title/Name");
Show(col);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I'm definitely not saying that JSL documentation is best, but it does have quite a bit of material (and great community and support with email). For starters these are good sources:&lt;/P&gt;&lt;P&gt;&lt;A href="https://support.sas.com/documentation/onlinedoc/jmp/15/Scripting-Guide.pdf" target="_self"&gt;JMP15 - Scripting Guide&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.jmp.com/support/help/en/16.0/index.shtml#page/jmp/what-jsl-can-do-for-you.shtml#" target="_self"&gt;JMP Help&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Scripting Index directly from JMP&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If there is something missing or unclear in JMP Help or Scripting Index, I'm fairly sure JMP would be happy to improve them.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/6878"&gt;@Jeff_Perkinson&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 24 Jun 2021 19:20:48 GMT</pubDate>
    <dc:creator>jthi</dc:creator>
    <dc:date>2021-06-24T19:20:48Z</dc:date>
    <item>
      <title>Referencing a Column in JSL</title>
      <link>https://community.jmp.com/t5/Discussions/Referencing-a-Column-in-JSL/m-p/395844#M64652</link>
      <description>&lt;P&gt;I'm continually astounded by how much basic information on JSL is missing from tutorials and internet searches. I'm not sure how one is expected to learn the basics of this language without poring through massive quantities of addon unnecessary information, and then fail in the end to find what is needed anyway. I guess that's why the Discussion forums are available as a resource.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to simply reference a column given a data table in JSL.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = Open("filepath.jsl");
col = dt:"Column Title/Name";&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;when I Write() the col nothing shows up, implying the reference doesn't reference. The column is clearly populated with data, it's not empty, I checked. Stupid error to make but I've got that covered. Having said that, I don't know what's wrong. I thought this was a pretty basic thing in JSL but I'm continuously finding that these "very basic things in JSL" fall through and cost precious minutes to hours of troubleshooting when I could be working on the logic of my code. I'm inclined to file a complaint with my manager about our use of this language and suggest potentially switching to something more logical and well-designed for programming (obviously JSL is for statistical use, not really for programming logic), like Python.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;lt;sigh&amp;gt;. Thank you for your any assistance.&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jun 2023 19:50:42 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Referencing-a-Column-in-JSL/m-p/395844#M64652</guid>
      <dc:creator>mostarr</dc:creator>
      <dc:date>2023-06-09T19:50:42Z</dc:date>
    </item>
    <item>
      <title>Re: Referencing a Column in JSL</title>
      <link>https://community.jmp.com/t5/Discussions/Referencing-a-Column-in-JSL/m-p/395851#M64653</link>
      <description>The correct syntax is : col = Column (dt, "Name")</description>
      <pubDate>Thu, 24 Jun 2021 18:35:13 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Referencing-a-Column-in-JSL/m-p/395851#M64653</guid>
      <dc:creator>Thierry_S</dc:creator>
      <dc:date>2021-06-24T18:35:13Z</dc:date>
    </item>
    <item>
      <title>Re: Referencing a Column in JSL</title>
      <link>https://community.jmp.com/t5/Discussions/Referencing-a-Column-in-JSL/m-p/395869#M64655</link>
      <description>&lt;P&gt;If I remember correctly using dt:"colname" (same as you would use As Column()) will get you direct access to current&amp;nbsp;value of the current Row() of the column named "colname" in datatable with reference dt. To get a reference to column you can use Column(dt, "colname") as &lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/11634"&gt;@Thierry_S&lt;/a&gt; said.&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(5),
	Compress File When Saved(1),
	New Column("Column Title/Name",
		Character,
		"Nominal",
		Set Values({"a1", "b2", "c3", "d4", ""})
	)
);
For each row(dt,
	col = dt:"Column Title/Name";
	Show(col);	
);

Row() = 1;
col = AsColumn(dt, "Column Title/Name");
Show(col);

col = Column(dt, "Column Title/Name");
Show(col);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I'm definitely not saying that JSL documentation is best, but it does have quite a bit of material (and great community and support with email). For starters these are good sources:&lt;/P&gt;&lt;P&gt;&lt;A href="https://support.sas.com/documentation/onlinedoc/jmp/15/Scripting-Guide.pdf" target="_self"&gt;JMP15 - Scripting Guide&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.jmp.com/support/help/en/16.0/index.shtml#page/jmp/what-jsl-can-do-for-you.shtml#" target="_self"&gt;JMP Help&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Scripting Index directly from JMP&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If there is something missing or unclear in JMP Help or Scripting Index, I'm fairly sure JMP would be happy to improve them.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/6878"&gt;@Jeff_Perkinson&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Jun 2021 19:20:48 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Referencing-a-Column-in-JSL/m-p/395869#M64655</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2021-06-24T19:20:48Z</dc:date>
    </item>
    <item>
      <title>Re: Referencing a Column in JSL</title>
      <link>https://community.jmp.com/t5/Discussions/Referencing-a-Column-in-JSL/m-p/395872#M64656</link>
      <description>&lt;P&gt;&lt;FONT size="2"&gt;[NB: I had written most of this before&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/14366"&gt;@jthi&lt;/a&gt;&amp;nbsp;replied and said much the same thing.]&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;First, if you haven't read (at least the first few chapters) of the &lt;A href="https://www.jmp.com/support/help/en/16.0/#page/jmp/what-jsl-can-do-for-you.shtml#ww228936" target="_blank" rel="noopener"&gt;JMP Scripting Guide&lt;/A&gt;&amp;nbsp;(&lt;A href="https://www.jmp.com/content/dam/jmp/documents/en/support/jmp16/scripting-guide.pdf" target="_blank" rel="noopener"&gt;PDF&lt;/A&gt;, if preferred) you really should.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;JMP is a scripting language, not a programming language. It's tied very closely to the user interface for JMP and meant to allow for automation of JMP tasks. Trying to think of it the same way you think of Python or other languages which are not controlling a user interface will lead to frustration.&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;I'm trying to simply reference a column given a data table in JSL.&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Your question is an example of that. The concept of "referenc[ing] a column" is complicated because a "column" could mean different things in different contexts (e.g., a platform call, manipulating the properties of a column, a column formula).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So, what did you what "col" to contain in your example? The data contained in the column? The value of a particular row of that column?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or, asked differently? Where did you want to use "col" after you got it set to whatever you wanted it to contain? In a platform call (e.g., Distribution(Y(col))? Or somewhere else?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Jun 2021 19:27:20 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Referencing-a-Column-in-JSL/m-p/395872#M64656</guid>
      <dc:creator>Jeff_Perkinson</dc:creator>
      <dc:date>2021-06-24T19:27:20Z</dc:date>
    </item>
  </channel>
</rss>

