<?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: How to create a indicator column for double data with a formula in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/How-to-create-a-indicator-column-for-double-data-with-a-formula/m-p/195323#M41634</link>
    <description>&lt;P&gt;First&lt;/P&gt;&lt;P&gt;Within the formula editor the the&amp;nbsp;first Code line is marked with the red line.&lt;/P&gt;&lt;P&gt;Second&lt;/P&gt;&lt;P&gt;In case the formula is being applied, a pop up window&amp;nbsp;appears with the messages like "Send Expects Scriptable Objects ...; Send, dt &amp;lt;&amp;lt; /*###*/" or "Selection() /*###*/"&lt;/P&gt;</description>
    <pubDate>Mon, 29 Apr 2019 15:24:00 GMT</pubDate>
    <dc:creator>Thomas1</dc:creator>
    <dc:date>2019-04-29T15:24:00Z</dc:date>
    <item>
      <title>How to create a indicator column for double data with a formula</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-create-a-indicator-column-for-double-data-with-a-formula/m-p/195321#M41632</link>
      <description>&lt;P&gt;I' dlike to create a formula indicator column for double data by applying the following JSL Code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt &amp;lt;&amp;lt; Clear Column Selection();
dt &amp;lt;&amp;lt; Select Duplicate Rows();
dt &amp;lt;&amp;lt; Name Selection in Column( Selected( 1 ), Unselected( 0 ) );
dt &amp;lt;&amp;lt; Clear Select();&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Despite I 'm getting the right results, the code creates a lot error messages. It would be&amp;nbsp;great if the code could be improved.&lt;/P&gt;</description>
      <pubDate>Mon, 29 Apr 2019 14:47:04 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-create-a-indicator-column-for-double-data-with-a-formula/m-p/195321#M41632</guid>
      <dc:creator>Thomas1</dc:creator>
      <dc:date>2019-04-29T14:47:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a indicator column for double data with a formula</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-create-a-indicator-column-for-double-data-with-a-formula/m-p/195322#M41633</link>
      <description>&lt;P&gt;Your code looks good......what errors are you getting?&lt;/P&gt;</description>
      <pubDate>Mon, 29 Apr 2019 15:04:54 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-create-a-indicator-column-for-double-data-with-a-formula/m-p/195322#M41633</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2019-04-29T15:04:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a indicator column for double data with a formula</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-create-a-indicator-column-for-double-data-with-a-formula/m-p/195323#M41634</link>
      <description>&lt;P&gt;First&lt;/P&gt;&lt;P&gt;Within the formula editor the the&amp;nbsp;first Code line is marked with the red line.&lt;/P&gt;&lt;P&gt;Second&lt;/P&gt;&lt;P&gt;In case the formula is being applied, a pop up window&amp;nbsp;appears with the messages like "Send Expects Scriptable Objects ...; Send, dt &amp;lt;&amp;lt; /*###*/" or "Selection() /*###*/"&lt;/P&gt;</description>
      <pubDate>Mon, 29 Apr 2019 15:24:00 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-create-a-indicator-column-for-double-data-with-a-formula/m-p/195323#M41634</guid>
      <dc:creator>Thomas1</dc:creator>
      <dc:date>2019-04-29T15:24:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a indicator column for double data with a formula</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-create-a-indicator-column-for-double-data-with-a-formula/m-p/195324#M41635</link>
      <description>&lt;P&gt;OK......my previous comment was based upon the assumption that the code was being run in open code, rather than as a formula.&amp;nbsp; Using this as a formula, there are some concerns.&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;The pointer to the data table, dt,&amp;nbsp; must be defined in the formula, if you are going to reference it.&lt;/LI&gt;
&lt;LI&gt;You are using functions that automatically move through all rows when executed.&amp;nbsp; Formulas also loop across all rows in a data table and execute the formula once for each row.&amp;nbsp; Therefore, using the code the way you are doing it means that you are running the&amp;nbsp; "Select Duplicate Rows" over and over again, when in actuallity, you only need to execute it once.&lt;/LI&gt;
&lt;LI&gt;The red line for your first line in the fomula is really a warning, not an error.&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;Below is a version of your code that I would use, if using this as a formula.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;If( Row() == 1,
	dt = Current Data Table();
	dt &amp;lt;&amp;lt; Clear Column Selection();
	dt &amp;lt;&amp;lt; Select Duplicate Rows();
	dt &amp;lt;&amp;lt; Name Selection in Column( Selected( 1 ), Unselected( 0 ) );
	dt &amp;lt;&amp;lt; Clear Select();
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am not really clear on why you would want to put this into a formula column, since the column you place it in, will contain all missing values.......so you may want to rethink your process.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;&amp;nbsp;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 29 Apr 2019 15:51:08 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-create-a-indicator-column-for-double-data-with-a-formula/m-p/195324#M41635</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2019-04-29T15:51:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a indicator column for double data with a formula</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-create-a-indicator-column-for-double-data-with-a-formula/m-p/195333#M41638</link>
      <description>&lt;P&gt;Hi Jim,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks for&amp;nbsp;your support. I tried to&amp;nbsp;simplify my topic. My goal is to create a column in which the&amp;nbsp;multiple data are addressed. I was able to do this with the following JSL:&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 = Current Data Table();
dt &amp;lt;&amp;lt; Select Columns( :Column 1, :Column 2);
dt &amp;lt;&amp;lt; Select Duplicate Rows();
dt &amp;lt;&amp;lt; Name Selection in Column(
       Column Name( "MultipleData" ),
       Selected( 1 ),
       Unselected( 0 ));
 
dt &amp;lt;&amp;lt; Clear Select();&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;for multiple data from column 1 and 2, of the attached file. This works fine.&amp;nbsp; However, because the working files are frequently updated with new data via SQL, I would prefer to create a formula&amp;nbsp; Column "MultipleData".&lt;/P&gt;&lt;P&gt;Unfortunately I'm&amp;nbsp;getting only zeros, if your last code is being applied. What could be a solution?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 29 Apr 2019 17:56:50 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-create-a-indicator-column-for-double-data-with-a-formula/m-p/195333#M41638</guid>
      <dc:creator>Thomas1</dc:creator>
      <dc:date>2019-04-29T17:56:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a indicator column for double data with a formula</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-create-a-indicator-column-for-double-data-with-a-formula/m-p/195341#M41646</link>
      <description>&lt;P&gt;I am hoping there is a community member that can solve your question better than the method that I used below.&amp;nbsp; Given what you want, there are conflicting issues in trying to use the selection capability of the data table, but then you want to clear the selections.&amp;nbsp; That would force the recalculation of the formula.&amp;nbsp; So what I have done, is to have the formula create a subset of the data table, perform your calculations on the subsetted data table( isolating the selections) and then reading the results from the subset back to the original data table....and then deleting the subsetted data table.&amp;nbsp; Take a look and see if you understand what I am doing.&amp;nbsp; It appears to work.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;If( Row() == 1,
	dt = Current Data Table();
	dt &amp;lt;&amp;lt; Select Columns( :Column 1, :Column 2 );
	dt2 = dt &amp;lt;&amp;lt; subset(
		private,
		dt,
		selected rows( 0 ),
		selected columns( 1 )
	);
	dt2 &amp;lt;&amp;lt; Select Duplicate Rows();
	dt2 &amp;lt;&amp;lt; Name Selection in Column(
		Column Name( "MultipleData" ),
		Selected( 1 ),
		Unselected( 0 )
	);
);
x = dt2:MultipleData[Row()];
If( Row() == N Rows( dt ),
	dt &amp;lt;&amp;lt; clear column selection;
	Close( dt2, nosave );
);
x;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 30 Apr 2019 03:12:44 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-create-a-indicator-column-for-double-data-with-a-formula/m-p/195341#M41646</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2019-04-30T03:12:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a indicator column for double data with a formula</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-create-a-indicator-column-for-double-data-with-a-formula/m-p/196959#M41656</link>
      <description>&lt;P&gt;Hi Jim,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the solution. I did test your code with a formula column, on a big&amp;nbsp;&amp;nbsp;database (some 100k rows and 100 columns). It worked fine.&lt;/P&gt;&lt;P&gt;My solution is the following JSL code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&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 = Current Data Table();

//Delete preveious version of the indicator column
dt &amp;lt;&amp;lt; Delete Columns("MultipleData");

wait(2);

//Create the new  version of the indicator column
dt &amp;lt;&amp;lt; Select Columns( :Column 1, :Column 2);
dt &amp;lt;&amp;lt; Select Duplicate Rows();
dt &amp;lt;&amp;lt; Name Selection in Column(
	Column Name( "MultipleData" ),
	Selected( 1 ),
	Unselected( 0 ));
	
dt &amp;lt;&amp;lt; Clear Select();

dt &amp;lt;&amp;lt; Clear Column Selection();&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;As I mentioned before,&amp;nbsp; a formula solution, like your code, is preferred. It is more convenient, in case the data set is updated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Apr 2019 14:38:51 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-create-a-indicator-column-for-double-data-with-a-formula/m-p/196959#M41656</guid>
      <dc:creator>Thomas1</dc:creator>
      <dc:date>2019-04-30T14:38:51Z</dc:date>
    </item>
  </channel>
</rss>

