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.
  • Image to Table JMP extension imports single or batch images as data tables. Useful to extract curves from pictures or convert image data to curve data to use in analyses like Functional Data Explorer. Download and install the extension.

Discussions

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

Delimit text and create new row

hey folks,

I am using a previous example from the forum.

My code works for the first part I am doing.

When I add the value into the new row I want to increment machine by 1. 

So below  would like ABC_RC1,RC2,RC3... not sure how to do this part.

jearls11_4-1670857979242.png

 

machineoperationrecipenameData_Column
ABC_RC123456TEST[0.941279597;0.941279597;0.947636808]

 

 

Names Default To Here( 1 );
dt = Data Table( "Untitled 166");
dtOut = New Table( "Final Output1",

New Column( "machine", character ),
New Column( "operation", numeric ),
New Column( "recipename", character ),
New Column( "Data_Column", character ),



New Column( "Data_1", numeric ),



);
For( i = 1, i <= N Rows( dt ), i++,
	If( i == 1,
		theRow = 0;
		theRow = N Rows( dtOut );
	);
	If( dt:Data_Column[i] != "X",
		dtOut << Add Rows( 3 );
		For( k = 1, k <= 3, k++,
			theRow++;
			dtOut:machine[theRow] = dt:machine[i];
			dtOut:operation[theRow] = dt:operation[i];
			dtOut:recipename[theRow] = dt:recipename[i];
			dtOut:Data_Column[theRow] = dt:Data_Column[i];
			
			dtOut:Data_1[theRow] = Substr( Word( k, dt:Data_Column[i], ";" ), 2, 7 );
		
			
	
		);
	);
);

 



 

3 REPLIES 3
jearls11
Level III

Re: Delimit text and create new row

Could I add a new column and do a 1++ and the then concatenate?

jearls11
Level III

Re: Delimit text and create new row

Sorry, the concat wont work as it foes 1,2,3,4,5.... i need, 1,2,3,1,2,3.
Can I do this?
dtOut:RC[theRow] = Sequence( 1, 2, 1, 1 );

 

or just create a new column and do a sequence?

 

Re: Delimit text and create new row

I have a feeling I'm not understanding what you're needing, but:

if the number you're adding to machine is the sequence of 1, 2, 3 repeated, would the modulo() function work for your needs? Something like the following? 

"ABC_RC" || Char( Modulo( Row(), 3 ) + 1 )

Recommended Articles