cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Don’t miss your chance to experience Discovery Summit Europe at our best available rate! Early bird registration through 31 Oct.
  • Graph Builder Toolbar streamlines interactive graphing. Creates shortcuts on Report and GraphBuilder Helpers toolbars. Download and install the extension.
  • JMP will suspend normal business operations for our Rest and Recharge Day on Friday, October 2, 2026.
    Regular business hours will resume on Monday, October 5, 2026.

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
lpatton
Level I

How do I compare column values in loop using indexed naming.

I am trying to create a column and assign that column a value to a column only when the values in two other columns are equivalent.   I have to use indexed naming as I am in a loop and will not always know what the column name is or what the number is (see image below).  The script creates the new column but does not correctly evaluate my formula.    Please help!

 

 

 

RamanFail.png

 

 

My Script:

dt<< New Column(RamanPeakList[NameIndex] || " Peak", <<Set Each Value( 
			If( Column(RamanPeakList[NameIndex] || " Peak Intensity") == Column("Temp"||RamanPeakList[NameIndex]), 
			:Raman Shift)));
1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: How do I compare column values in loop using indexed naming.

If you were using a formula to set the values, then you code would probably work.  However, since you are using Set Each Value, I assume that you need to specify the specific row value to do the calculation on.  The below script worked for me

dt << New Column( RamanPeakList[NameIndex] || " Peak",
	<<Set Each Value(
		If(
			Column( RamanPeakList[NameIndex] || " Peak Intensity" )[Row()] == Column(
				"Temp" || RamanPeakList[NameIndex]
			)[Row()],
			:Raman Shift
		)
	)
);
Jim

View solution in original post

1 REPLY 1
txnelson
Super User

Re: How do I compare column values in loop using indexed naming.

If you were using a formula to set the values, then you code would probably work.  However, since you are using Set Each Value, I assume that you need to specify the specific row value to do the calculation on.  The below script worked for me

dt << New Column( RamanPeakList[NameIndex] || " Peak",
	<<Set Each Value(
		If(
			Column( RamanPeakList[NameIndex] || " Peak Intensity" )[Row()] == Column(
				"Temp" || RamanPeakList[NameIndex]
			)[Row()],
			:Raman Shift
		)
	)
);
Jim

Recommended Articles