<?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: Create &amp;quot;Source Table&amp;quot; Column in Table that references Data Table Name in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Create-quot-Source-Table-quot-Column-in-Table-that-references/m-p/769594#M95035</link>
    <description>&lt;P&gt;Thank you!!!&amp;nbsp;&lt;BR /&gt;This solves my problem beautifully!&lt;/P&gt;</description>
    <pubDate>Mon, 01 Jul 2024 19:33:06 GMT</pubDate>
    <dc:creator>kmprosperi</dc:creator>
    <dc:date>2024-07-01T19:33:06Z</dc:date>
    <item>
      <title>Create "Source Table" Column in Table that references Data Table Name</title>
      <link>https://community.jmp.com/t5/Discussions/Create-quot-Source-Table-quot-Column-in-Table-that-references/m-p/769577#M95031</link>
      <description>&lt;P&gt;Hi!&lt;BR /&gt;&lt;BR /&gt;I'd like to create a column called "Source Table" that auto populates with the name of data table that is being worked on.&lt;BR /&gt;This is done when concatenating multiple file names; but I'd like to do it at the start of all my workflows as a matter of practice (without having to manually add it).&lt;BR /&gt;&lt;BR /&gt;Is this possible?&lt;BR /&gt;Thanks!&lt;BR /&gt;Katie&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 01 Jul 2024 19:14:01 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Create-quot-Source-Table-quot-Column-in-Table-that-references/m-p/769577#M95031</guid>
      <dc:creator>kmprosperi</dc:creator>
      <dc:date>2024-07-01T19:14:01Z</dc:date>
    </item>
    <item>
      <title>Re: Create "Source Table" Column in Table that references Data Table Name</title>
      <link>https://community.jmp.com/t5/Discussions/Create-quot-Source-Table-quot-Column-in-Table-that-references/m-p/769587#M95032</link>
      <description>&lt;P&gt;You could at least add a small script to perform that column creation. Here is one option for that&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Local({dt, newcol},
	dt = Current Data Table();
	If(!Contains(dt &amp;lt;&amp;lt; Get Column Names("String"), "Source"),
		newcol = dt &amp;lt;&amp;lt; New Column("Source", Character, Nominal, Formula(
			dt &amp;lt;&amp;lt; get name;
		));
		dt &amp;lt;&amp;lt; Run Formulas;
		newcol &amp;lt;&amp;lt; Delete Formula;
	);
);&lt;/CODE&gt;&lt;CODE class=" language-jsl"&gt;&lt;/CODE&gt;&lt;CODE class=" language-jsl"&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;(I added If statement to avoid re-creation of the column if Source column already exists, but you can drop it if it isn't needed)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 01 Jul 2024 19:23:40 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Create-quot-Source-Table-quot-Column-in-Table-that-references/m-p/769587#M95032</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2024-07-01T19:23:40Z</dc:date>
    </item>
    <item>
      <title>Re: Create "Source Table" Column in Table that references Data Table Name</title>
      <link>https://community.jmp.com/t5/Discussions/Create-quot-Source-Table-quot-Column-in-Table-that-references/m-p/769588#M95033</link>
      <description>&lt;P&gt;Also in this case you can use Set Each Value, it makes the script a bit simpler&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Local({dt, newcol},
	dt = Current Data Table();
	If(!Contains(dt &amp;lt;&amp;lt; Get Column Names("String"), "Source"),
		newcol = dt &amp;lt;&amp;lt; New Column("Source", Character, Nominal, Set Each Value(
			dt &amp;lt;&amp;lt; get name;
		));
	);
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Edit:&lt;/P&gt;
&lt;P&gt;A bit cleaned version below, as this doesn't need Local() (I added it for newcol variable to make it easier to remove the formula from created column for the formula version)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;If(!Contains(Current Data Table() &amp;lt;&amp;lt; Get Column Names("String"), "Source"),
	Current Data Table() &amp;lt;&amp;lt; New Column("Source", Character, Nominal, Set Each Value(
		Current Data Table() &amp;lt;&amp;lt; get name;
	));
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 01 Jul 2024 19:35:22 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Create-quot-Source-Table-quot-Column-in-Table-that-references/m-p/769588#M95033</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2024-07-01T19:35:22Z</dc:date>
    </item>
    <item>
      <title>Re: Create "Source Table" Column in Table that references Data Table Name</title>
      <link>https://community.jmp.com/t5/Discussions/Create-quot-Source-Table-quot-Column-in-Table-that-references/m-p/769592#M95034</link>
      <description>&lt;P&gt;Here is a Work Flow step that can be added that adds the Source Table column to the current data table&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="txnelson_0-1719862133916.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/65766iC49812AC189686A4/image-size/medium?v=v2&amp;amp;px=400" role="button" title="txnelson_0-1719862133916.png" alt="txnelson_0-1719862133916.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="txnelson_1-1719862163675.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/65767i405C9991B512C374/image-size/medium?v=v2&amp;amp;px=400" role="button" title="txnelson_1-1719862163675.png" alt="txnelson_1-1719862163675.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 01 Jul 2024 19:29:47 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Create-quot-Source-Table-quot-Column-in-Table-that-references/m-p/769592#M95034</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2024-07-01T19:29:47Z</dc:date>
    </item>
    <item>
      <title>Re: Create "Source Table" Column in Table that references Data Table Name</title>
      <link>https://community.jmp.com/t5/Discussions/Create-quot-Source-Table-quot-Column-in-Table-that-references/m-p/769594#M95035</link>
      <description>&lt;P&gt;Thank you!!!&amp;nbsp;&lt;BR /&gt;This solves my problem beautifully!&lt;/P&gt;</description>
      <pubDate>Mon, 01 Jul 2024 19:33:06 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Create-quot-Source-Table-quot-Column-in-Table-that-references/m-p/769594#M95035</guid>
      <dc:creator>kmprosperi</dc:creator>
      <dc:date>2024-07-01T19:33:06Z</dc:date>
    </item>
    <item>
      <title>Re: Create "Source Table" Column in Table that references Data Table Name</title>
      <link>https://community.jmp.com/t5/Discussions/Create-quot-Source-Table-quot-Column-in-Table-that-references/m-p/769596#M95036</link>
      <description>&lt;P&gt;Thank you!! I am stepping away from standalone scripts &amp;amp; into the world of workflows!&amp;nbsp; This will be helpful!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 01 Jul 2024 19:34:01 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Create-quot-Source-Table-quot-Column-in-Table-that-references/m-p/769596#M95036</guid>
      <dc:creator>kmprosperi</dc:creator>
      <dc:date>2024-07-01T19:34:01Z</dc:date>
    </item>
  </channel>
</rss>

