Referencing to a specific data tableHi,
I have a data table dtValues.I have sorted the data table as follows -
dtValues << Sort(
By( :test_end_date_1 ),
Order( Ascending ),
Output Table( "out_sorted" )
);
Now I want to get unique values from a column "weight" from the out_sorted table.
I tried the following code -
unique_wt = {};
unique_wt = Associative Array( dtValues:weight ) << Get Keys
But this code gives unique values from the table before sorting.I am looking for weight values from the sorted table.
How do I get around this?
Re: Referencing to a specific data tableIs there a work around for this? Like may be get all the values in the column and remove duplicates?
Without using associative arrays that is.
Re: Referencing to a specific data tableThe following quote is taken from the Scripting Guide, in reference to Associative Arrays
• Though associative arrays are not usually ordered, in JMP, keys are returned in
alphanumeric order for the purpose of iteration and serialization.
Re: Referencing to a specific data tableThanks for the response.
But looks like
unique_wt <SPAN class="token operator">=</SPAN> <SPAN class="token function">Associative Array</SPAN><SPAN class="token punctuation">(</SPAN> dtSorted<SPAN class="token punctuation">:</SPAN>weight <SPAN class="token punctuation">)</SPAN> <SPAN class="token operator"><</SPAN><SPAN class="token operator"><</SPAN><SPAN class="token messages"> Get Keys</SPAN><SPAN class="token punctuation">;</SPAN>
outputs the key in ascending order by default.
I wanted to get the weight values in the order they appear in the column and not in ascending order.
Is there any other way to achieve this?
Thanks
Re: Referencing to a specific data tableYou need to set a pointer to the new data table that is being created. The below code does that:
dtSorted = dtValues << Sort(
By( :test_end_date_1 ),
Order( Ascending ),
Output Table( "out_sorted" )
);
unique_wt = {};
unique_wt = Associative Array( dtSorted:weight ) << Get Keys;