cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • DownloadSemiconductor Toolkit: Tools to create wafer maps, add wafer geometry to graphics, explore die defects & compare wafers.
  • Discovery Summit 2026: Early User Edition - September 23-24.Register. It's free.
  • See how to design an experiment, explore factor-response relationships, assess tradeoffs, and ID best settings. Register for Sep. 11 Mastering JMP.

Discussions

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

Looping over a List and concatenating a string

Hi,  I have a "List" and I want to concatenate each item with the suffix "_2020" and Insert it into a new list.
I have tried this code but I am missing something.  I will appreciate your input.

Thanks!

Names Default To Here( 1 );

FullNames ={};

todaysList = {"August", "July", "June", "May"};

TotalMs = N Items (todaysList);

For (i = todaysList, i <= TotalMs, i++,
	
	newName = (todaysList[i] ||"_2020");
	Insert Into (FullNames, newName),
	
);

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: Looping over a List and concatenating a string

Your For() loop starting index was invalid.  Here is your code with a slight modification to make it work

Names Default To Here( 1 );

FullNames ={};

todaysList = {"August", "July", "June", "May"};

TotalMs = N Items (todaysList);

For (i = 1, i <= TotalMs, i++,
	
	newName = todaysList[i] ||"_2020";
	Insert Into (FullNames, newName),
	
);
Jim

View solution in original post

3 REPLIES 3
txnelson
Super User

Re: Looping over a List and concatenating a string

Your For() loop starting index was invalid.  Here is your code with a slight modification to make it work

Names Default To Here( 1 );

FullNames ={};

todaysList = {"August", "July", "June", "May"};

TotalMs = N Items (todaysList);

For (i = 1, i <= TotalMs, i++,
	
	newName = todaysList[i] ||"_2020";
	Insert Into (FullNames, newName),
	
);
Jim
ALopez
Level III

Re: Looping over a List and concatenating a string

Yes, I can see my Index error, darn so obvious (after you mentioned).  What I still do not understand is the lack of parenthesis around the concatenation expression.  I will do some more reading.
Thank you very much.

Best regards,

Alfredo

Re: Looping over a List and concatenating a string

Hi,

 

Searching the Concat function in the JMP Scripting Index (Help->Scripting Index), it can be seen that use of the double bar operator doesn't require parentheses.  In case you weren't aware of it, the Scripting Index is a very powerful resource.

 

Capture.PNGCapture.PNG

 

Recommended Articles