Choose Language Hide Translation Bar
Highlighted
Brad_Park
Level I

Automatic local data filter

Hello, everyone,

Could you please give me your hand to solve problems.

 

1. The situation
I am trying to make a script to automate drawing graphs every day.

This is a situation that I need to create data for each equipment station daily used.
Meanwhile, as the number of stations is large (ex. there's 40 stations), I cannot plot all of station in one graph. So I select three stations on one graph with local data filter.

However, as the used equipment station changes every day,

I cannot use code like below, 


Local Data Filter(
Width( 178 ),
Add Filter(
columns( :Station ),
Where( :Station == {"Tx #5", "Tx #6", "Tx #7"} ),
Display( :Station, Size( 172, 493 ), Height( 493))
)
),

 

2. Designed Solution

So I came up with the following method.
  1. select the Station column.
  2. Make the column as a list
  3. Remove duplicate values ​​from the list. (->To get a list of used stations)
  4. Use the local data filter to select 3 stations from the list obtained in step 3.

 

3. Problem

  1. Station column is selected and I made it into a list, but duplicates are not removed.
  2. I have no idea how to apply the local data filter for each 3 stations in the list.

 

 

Thank you.

-Sejin Park.

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
txnelson
Super User

Re: Automatic local data filter

I am not quite sure what your question is, but let me make a guess.  You want to get either, all of the values from a column into a list, or you want to get all of the unique values from a column into a list.  Below there are 2 examples, one that will read all values into a list, and the second example will get only the unique values.

names default to here(1);
dt=open("$SAMPLE_DATA/big class.jmp");

// Get all values from a column
allValueList = dt:sex << get values;

// get unique values
summarize( dt, uniqueValueList = by(:sex));

// Look in the log for the output
Show("All Values", allValueList, "Unique Values", uniqueValueList); 
Jim

View solution in original post

4 REPLIES 4
Highlighted
txnelson
Super User

Re: Automatic local data filter

You need to use the Summarize() function. If you specify your column as the By() column, it will return a list of unique values for Stations

summarize( stationList = By( :Station ) );
Jim
Highlighted
Brad_Park
Level I

Re: Automatic local data filter

Hi Jim, 

 

This is Brad Park. 

 

I've try to use it but somehow, I forgot how to make the list of value of specific column...

 

I'm trying to make a list of row (of specified column) with a each row () function. 

 

Could you please tell me if there's better way to do it?

 

Thank you 

Highlighted
txnelson
Super User

Re: Automatic local data filter

I am not quite sure what your question is, but let me make a guess.  You want to get either, all of the values from a column into a list, or you want to get all of the unique values from a column into a list.  Below there are 2 examples, one that will read all values into a list, and the second example will get only the unique values.

names default to here(1);
dt=open("$SAMPLE_DATA/big class.jmp");

// Get all values from a column
allValueList = dt:sex << get values;

// get unique values
summarize( dt, uniqueValueList = by(:sex));

// Look in the log for the output
Show("All Values", allValueList, "Unique Values", uniqueValueList); 
Jim

View solution in original post

Highlighted
Brad_Park
Level I

Re: Automatic local data filter

Thank you so much

 

2nd function was what I was searching for. 

 

Thank you !

 

 

Article Labels