cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Browse apps to extend the software in the new JMP Marketplace
Choose Language Hide Translation Bar
RA899
Level III

Concatenate a string to an integer.

Hi. 

I'm trying to create new columns with the same name, but different extension.

 

For example, I'm trying to create column 1 & column 2 &column 3... etc. 

 

Here is what I have: 

 

lista = list(1 , 2, 3 , 4); 



for(i1=1, i1<N Items ( lista)+1, i1++,
 dt_limit << new column (    insert( "condition", char ( lista(i1) )  )    );

);

 

 

it doesn't seem to work, however. It either returns an error or return something like this: " condition (1, 2, 3, 4) " or: "conditionlista"

 

Any guidance is appreciated. 

2 ACCEPTED SOLUTIONS

Accepted Solutions
RA899
Level III

Re: Concatenate a string to an integer.

I realized I was using () instead of [] for calling the list index. It looks like its working now. 

View solution in original post

txnelson
Super User

Re: Concatenate a string to an integer.

Here are a couple of ways that I typically use

Names Default To Here( 1 );

lista = List( 1, 2, 3, 4 ); 

For( i1 = 1, i1 < N Items( lista ) + 1, i1++,
	dt_limit << New Column( "condition" || " " || Char( lista( i1 ) ) );
);

or

Names Default To Here( 1 );

lista = List( 1, 2, 3, 4 ); 

For each( {member}, lista,
	dt_limit << New Column( "condition" || " " || Char( member ) ) );
);
Jim

View solution in original post

2 REPLIES 2
RA899
Level III

Re: Concatenate a string to an integer.

I realized I was using () instead of [] for calling the list index. It looks like its working now. 

txnelson
Super User

Re: Concatenate a string to an integer.

Here are a couple of ways that I typically use

Names Default To Here( 1 );

lista = List( 1, 2, 3, 4 ); 

For( i1 = 1, i1 < N Items( lista ) + 1, i1++,
	dt_limit << New Column( "condition" || " " || Char( lista( i1 ) ) );
);

or

Names Default To Here( 1 );

lista = List( 1, 2, 3, 4 ); 

For each( {member}, lista,
	dt_limit << New Column( "condition" || " " || Char( member ) ) );
);
Jim