Subscribe Bookmark RSS Feed

How to look up a value in a cell.

zechariah

Community Member

Joined:

May 15, 2013

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
pmroz

Super User

Joined:

Jun 23, 2011

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];