cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Submit your abstract to the call for content for Discovery Summit Americas by April 23. Selected abstracts will be presented at Discovery Summit, Oct. 21- 24.
Choose Language Hide Translation Bar
xxvvcczz
Level III

Get Row numbers ... where row just exists. That's all I want is just a list of rows in the table ie [1,2,3,4,5,6]

I've got this GUI and I've got rows that I made

 

What I'm doing is using a row state handler to detect when someone selects mapped shapes in a graph.

That shows which rows they actually selected.

Now I have 2 helper "map shapes" in that graph as well. when they select something in the primary graph I need to highlight it in the helper graphs as well.

 

So this is my code, and I want selected to be live updated to be 1 or 2 so I can follow it up with another few lines that say:

get helper_rows that have the same keyname as the selected rows and select them too so the user knows they are related and I can then get them for a subset that is in my next step.

 

so my plan:

1. get list of all rows in table there has to be a better way than this... 

 all_rownums = subset_JMP_Master_Table << GetRowsWhere (:Name != -99999); 

2. inside the row state handler: get selected rows

3. subtract the selected rows from the total row list? Get 2 lists: 1 that is selected rows, and the other that is rows that arent selected.

4. Assign selected flag as 1 or 2 to the selected column.

5. Lookup helper rows based on  keyname + selected column = 1 

6. select the helper rows as well and subset the whole thing for next steps.

 

 

 

 subset_JMP_Master_Table << New Column( "selected", 
 Numeric
 , Ordinal
 ,set each value(0)
 );
 
 all_rownums = subset_JMP_Master_Table << GetRowsWhere (:Name != -99999); 


//rows_in_subset_table = subset_JMP_Master_ Table << Select All Rows;
//show(rows_in_subset_table);

select_sync_rsh = subset_JMP_Master_Table << MakeRowStateHandler(
Function(
{a}


,if(

select_sync_script_on

,( //start doing things based on script

print(a);
r = subset_JMP_Master_Table << get selected rows;
Column(subset_JMP_Master_Table, "selected")[r] = 1;
q = subset_JMP_Master_Table << GetRowsWhere (:selected != 1); 
Column(subset_JMP_Master_Table, "selected")[q] = 2;


)//end doing things based on script


)// end if 
); //end function
);

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
xxvvcczz
Level III

Re: Get Row numbers ... where row just exists. That's all I want is just a list of rows in the table ie [1,2,3,4,5,6]

 

subset_JMP_Master_Table << New Column( "selected", Numeric, Ordinal, set each value( 0 ) );

fhg = N Rows( subset_JMP_Master_Table );

all_rownums = subset_JMP_Master_Table << GetRowsWhere( :Name != -99999 );

//rows_in_subset_table = subset_JMP_Master_ Table << Select All Rows;
//show(rows_in_subset_table);

select_sync_rsh = subset_JMP_Master_Table << MakeRowStateHandler(
    Function(
        {a}
    ,
        If( 
            select_sync_script_on
        ,
            (//start doing things based on script

            Print( a ) ; 

            subset_JMP_Master_Table:selected << Set Each Value( 2 ) ; // just blanket set everything to 2
            curr_selected_rows = subset_JMP_Master_Table << get selected rows ; // get the selected rows
            subset_JMP_Master_Table:selected[curr_selected_rows] = 1 ; //update the selected rows to 1

            )//end doing things based on script
        )// end if
    ); //end function
); //end row state handler

 

View solution in original post

3 REPLIES 3
xxvvcczz
Level III

Re: Get Row numbers ... where row just exists. That's all I want is just a list of rows in the table ie [1,2,3,4,5,6]

 

subset_JMP_Master_Table << New Column( "selected", Numeric, Ordinal, set each value( 0 ) );

fhg = N Rows( subset_JMP_Master_Table );

all_rownums = subset_JMP_Master_Table << GetRowsWhere( :Name != -99999 );

//rows_in_subset_table = subset_JMP_Master_ Table << Select All Rows;
//show(rows_in_subset_table);

select_sync_rsh = subset_JMP_Master_Table << MakeRowStateHandler(
    Function(
        {a}
    ,
        If( 
            select_sync_script_on
        ,
            (//start doing things based on script

            Print( a ) ; 

            subset_JMP_Master_Table:selected << Set Each Value( 2 ) ; // just blanket set everything to 2
            curr_selected_rows = subset_JMP_Master_Table << get selected rows ; // get the selected rows
            subset_JMP_Master_Table:selected[curr_selected_rows] = 1 ; //update the selected rows to 1

            )//end doing things based on script
        )// end if
    ); //end function
); //end row state handler

 

txnelson
Super User

Re: Get Row numbers ... where row just exists. That's all I want is just a list of rows in the table ie [1,2,3,4,5,6]

I think you can get your rownum matrix with

subset_JMP_Master_Table=current data table();
all_rownums = index(1,nrows(subset_JMP_Master_Table));
Jim
pmroz
Super User

Re: Get Row numbers ... where row just exists. That's all I want is just a list of rows in the table ie [1,2,3,4,5,6]

You can also use the syntax 1::n to produce a matrix:

subset_JMP_Master_Table=current data table();
b = 1::nrows(subset_JMP_Master_Table);