cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
New to using JMP? Hit the ground running with the Early User Edition of Discovery Summit. Register now, free of charge.
Register for our Discovery Summit 2024 conference, Oct. 21-24, where you’ll learn, connect, and be inspired.
Choose Language Hide Translation Bar
UnivariateTable
New Member

Find a column whose name needs a string from another column

I am trying to use a value from a column named "Freq " and find another column . I get an error Invalid Row

The column I am looking for is available. The column Freq is numeric. Is that the issue? 

For example the value in a row of the column Freq is 200 then I am looking for the value in IDynatTsense__200__65 . 

Code:

HashFreqval = Column( "Freq" );

IDyn = Column( "IDynatTsense__"||HashFreqval[]|| "__65" );

Error:

UnivariateTable_0-1726602124845.png

 

2 REPLIES 2
hogi
Level XI

Re: Find a column whose name needs a string from another column

column[] returns the value of the current row().

The default value of row() is 0. To access the value of row 1, just adjust the pointer via row()=1;

 

New Table( "test",
	Add Rows( 1 ),
	New Column( "Freq",
	Character,
		Set Values( {"200"} )
	),
	New Column( "IDynatTsense__200__65",
		Set Values( [20] )
	)
);


HashFreqval = Column( "Freq" );
row()=1;
IDyn = Column( "IDynatTsense__"||HashFreqval[]|| "__65" );
jthi
Super User

Re: Find a column whose name needs a string from another column

Error is caused by what hogi wrote, column()[] (same as column()[row()]) is looking for a value of current row which by default is 0 in JMP, which is invalid row number (you can read about this from Iterate on Rows in a Table (jmp.com)).

 

How are you utilizing this code? Most likely this isn't the whole code you are using? You are looking value from "Freq" but which row and are you maybe looping them? Are you trying to get a value from IDynatTsense__200__65 (which row?) or just the reference? 

-Jarmo