<?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 Try in context of Transposition in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Try-in-context-of-Transposition/m-p/795698#M97226</link>
    <description>&lt;P&gt;I have a script that performs a transposition of some data obtained from a SQL query.&amp;nbsp; I would like to add some forgiveness to the script whereby the exact columns in the query can vary.&amp;nbsp; My current script mandates a series of columns that need to be present for it to work and I'd like to apply the Try() functionality somehow to accommodate variance in the SQL query.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;I did an exercise with the transpose included in a try statement but that failed.&lt;/P&gt;</description>
    <pubDate>Thu, 05 Sep 2024 15:40:46 GMT</pubDate>
    <dc:creator>SpannerHead</dc:creator>
    <dc:date>2024-09-05T15:40:46Z</dc:date>
    <item>
      <title>Try in context of Transposition</title>
      <link>https://community.jmp.com/t5/Discussions/Try-in-context-of-Transposition/m-p/795698#M97226</link>
      <description>&lt;P&gt;I have a script that performs a transposition of some data obtained from a SQL query.&amp;nbsp; I would like to add some forgiveness to the script whereby the exact columns in the query can vary.&amp;nbsp; My current script mandates a series of columns that need to be present for it to work and I'd like to apply the Try() functionality somehow to accommodate variance in the SQL query.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;I did an exercise with the transpose included in a try statement but that failed.&lt;/P&gt;</description>
      <pubDate>Thu, 05 Sep 2024 15:40:46 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Try-in-context-of-Transposition/m-p/795698#M97226</guid>
      <dc:creator>SpannerHead</dc:creator>
      <dc:date>2024-09-05T15:40:46Z</dc:date>
    </item>
    <item>
      <title>Re: Try in context of Transposition</title>
      <link>https://community.jmp.com/t5/Discussions/Try-in-context-of-Transposition/m-p/795737#M97228</link>
      <description>&lt;P&gt;Which part do you have issues with? SQL query failing because column names change? Or JSL script failing because it doesn't get the columns it expects? What should happen in case of an issue?&lt;/P&gt;</description>
      <pubDate>Thu, 05 Sep 2024 16:16:16 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Try-in-context-of-Transposition/m-p/795737#M97228</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2024-09-05T16:16:16Z</dc:date>
    </item>
    <item>
      <title>Re: Try in context of Transposition</title>
      <link>https://community.jmp.com/t5/Discussions/Try-in-context-of-Transposition/m-p/795775#M97232</link>
      <description>&lt;P&gt;SQL pulls the data as expected but the operator might not include all the columns JMP expects to transpose.&amp;nbsp; The problem then occurs at the JMP end where explicit columns are nominated but turned up missing.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The JMP log indicates&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Column not found in access or evaluation of 'columns' , Bad Argument( {:SAMPLE} ).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 05 Sep 2024 18:56:20 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Try-in-context-of-Transposition/m-p/795775#M97232</guid>
      <dc:creator>SpannerHead</dc:creator>
      <dc:date>2024-09-05T18:56:20Z</dc:date>
    </item>
    <item>
      <title>Re: Try in context of Transposition</title>
      <link>https://community.jmp.com/t5/Discussions/Try-in-context-of-Transposition/m-p/795909#M97234</link>
      <description>&lt;P&gt;And what should be done in that case? Stop the program execution? Skip that part of the script? Attempt to get the correct columns?&lt;/P&gt;</description>
      <pubDate>Fri, 06 Sep 2024 05:13:35 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Try-in-context-of-Transposition/m-p/795909#M97234</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2024-09-06T05:13:35Z</dc:date>
    </item>
    <item>
      <title>Re: Try in context of Transposition</title>
      <link>https://community.jmp.com/t5/Discussions/Try-in-context-of-Transposition/m-p/796119#M97244</link>
      <description>&lt;P&gt;I only want to execute on the columns that actually turned up and not fail because of the missing ones.&amp;nbsp; I ultimately need a script that has some forgiveness for differences in the SQL query, as many operators need to use it and differences happen.&amp;nbsp; One advantage I have is that the Transpose Column (:VALUE) and the Label column (:PARAMETER) have fixed titles, I dug into this a bit with some help from the information I found here and elsewhere, I got the script below which seems to work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.jmp.com/t5/Discussions/remove-elements-in-a-list/td-p/50865" target="_blank" rel="noopener"&gt;Solved: remove elements in a list - JMP User Community&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = Current Data Table();

// List available columns

by_col_names = dt &amp;lt;&amp;lt; get column names( "String" );
show(by_col_names);

// Remove Transpose and Label columns from list

delcols = {"VALUE", "PARAMETER"};

For( i = 1, i &amp;lt;= N Items( delcols ), i++,
	Remove From( by_col_names, As List( Loc(by_col_names, delcols[i] ) ) );
);

// Transpose only if valid columns exist

If (N Items(by_col_names) &amp;gt; 0,
    dt2 = dt &amp;lt;&amp;lt; Transpose(
        Columns(:VALUE),
	By(
		by_col_names 
	),
	Label( :PARAMETER ),
        Output Table( "Transpose of dt_data" )
    );
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jan 2025 19:06:54 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Try-in-context-of-Transposition/m-p/796119#M97244</guid>
      <dc:creator>SpannerHead</dc:creator>
      <dc:date>2025-01-15T19:06:54Z</dc:date>
    </item>
  </channel>
</rss>

