cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Check out the JMP® Marketplace featured Capability Explorer add-in
Choose Language Hide Translation Bar
LYG
LYG
Level I

Delimit Multiple Columns JSL

Hi! 

I want to delimit multiple column using JSL but in vain

I've tried 2 method

 

1. Use "Contains" to select the specific column but last column always not get selected and delimit

2. Use regular expression but non of the column getting search and selected. 

 

If anyone could help take a look and clear my doubt would be much appreciated. Thanks

attached the jmp table sample

 

//1st method
dt = Data Table( "project_list" );
columnsToDelimit = {};
allColumns = dt << Get Column Names(String);
For( i=1, i <= N Items (allColumns ), i++,
	If( Contains ( allColumns[i], "MODEL"), 
		Insert into( columnsToDelimit, Column ( allColumns[i])),
            );
);
For(i = 1, i < N Items ( columnsToDelimit ), i++,
	dt << Text to Columns (
		Delimiter("%"),
		Columns( columnsToDelimit[i])
	);
);
//2nd method
dt = Data Table( "project_list" );
delimit_List = {};
col = dt << Get Column Names( String );

for (i = 1, i <= nitems(col), i++,
	if(Regex Match(col[i], "(.*)MODEL(.*)"),
		Insert Into( delimit_List, Column( col[i]));
	);
); 
For(i = 1, i < N Items ( delimit_List ), i++,
	dt << Text to Columns (
		Delimiter("%"),
		Columns( delimit_List[i])
	);
);
1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: Delimit Multiple Columns JSL

For(i = 1, i < N Items ( columnsToDelimit ), i++,

needs to be <=

For(i = 1, i <= N Items ( columnsToDelimit ), i++,
Jim

View solution in original post

2 REPLIES 2
txnelson
Super User

Re: Delimit Multiple Columns JSL

For(i = 1, i < N Items ( columnsToDelimit ), i++,

needs to be <=

For(i = 1, i <= N Items ( columnsToDelimit ), i++,
Jim
LYG
LYG
Level I

Re: Delimit Multiple Columns JSL

Thanks Jim. This works for the 1st method.