cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
JMP is taking Discovery online, April 16 and 18. Register today and join us for interactive sessions featuring popular presentation topics, networking, and discussions with the experts.
Choose Language Hide Translation Bar
zechariah
Level I

How to look up a value in a cell.

Can I assign a value to a variable using a database, a column, and a row?

My script, at present, opens a timestamped database of information for my system.  I add a column that declares the last row when a certain valve was open.  I can use Col Max to find the latest overall point when that occurs. I'd like to assign a variable for the Timestamp when that occurs.  Of course I could just make a new column that specifies the timestamp at each valve opening.

I just wondered if there was a way to look up a cell using row, column, and database.

1 REPLY 1
pmroz
Super User

Re: How to look up a value in a cell.

JMP table cell references are pretty easy.  If you have read in a table with this command:

dt = open database(dsn_string, "select * from mytable");

Suppose you want the value of the last row for the column called Timestamp.  You can reference that cell with syntax like this:

lr = nrows(dt);

one_cell = dt:timestamp[lr];

one_cell = column(dt, "Timestamp")[lr];

current data table(dt);     // need this to insure we're looking at the right table

one_cell = :Timestamp[lr];

one_cell = :name("Timestamp")[lr];