cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Discussions

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

Copying Row values to other Column

Hello,

 

Kindly help me I'm stuck when putting a formula into other column.

Here is expected output if SerialNumber is not empty copy row to Column ChipID else copy the same SN.

Capture.PNG

dtraw << New Column("ChipID", Character, Formula(
For( i = 1, i <= N Rows(dtraw), i++,
	If( Is Missing( :SerialNumber),
		:ChipID[i] = (:SerialNumber[1] & i = 1),
		:SerialNumber
		)
	)
);

 

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: Copying Row values to other Column

Here is my way of handling the issue

dtraw << New Column( "ChipID",
	Character,
	Formula(
		If( :SerialNumber != "",
			hold = :SerialNumber
		);
		hold;
	)
);
Jim

View solution in original post

2 REPLIES 2
jthi
Super User

Re: Copying Row values to other Column

You can use Lag() function here.

 

Names Default To Here(1);

dt = New Table("Untitled 6",
	Add Rows(6),
	New Column("SerialNumber", Character, "Nominal", Set Values({"30_A0_0", "", "", "30_A0_01", "", ""}))
);
dt << New Column("ChipID", Character, Nominal, Formula(If(Is Missing(:SerialNumber), Lag(:ChipID), :SerialNumber)));
-Jarmo
txnelson
Super User

Re: Copying Row values to other Column

Here is my way of handling the issue

dtraw << New Column( "ChipID",
	Character,
	Formula(
		If( :SerialNumber != "",
			hold = :SerialNumber
		);
		hold;
	)
);
Jim

Recommended Articles