How to delimit multiple column with specific string in jslHi,
I've a table that would like to delimit multiple column with specific string
Script below able to point to the specific column but unable to delimit the data
Appreciate if anyone could help on this. Thanks
Names Default To Here( 1 );
dt = Data Table( "Sales");
headerList = dt << get column names( string );
For( i = 1, i <= N Items( headerList ), i++,
If( Contains(headerList[i], "sales"),
Column( dt, headerList[i] ) << text to columns( delimiter( "_" ));
);
);
Automation and ScriptingMass CustomizationQuality and Process EngineeringRe: How to delimit multiple column with specific string in jslYou have to send that command to the table not the column. When you do, it inserts extra columns to the right so going left to right is going to break things. You need to go right to left (i-- instead of i++) This works:
Names Default To Here( 1 );
dt = Data Table( "Sales");
headerList = dt << get column names( string );
For( i = N Items( headerList ), i>=1, i--,
Data Table( "Sales" ) << Text to Columns(
columns( Column(dt, i) ),
Delimiters( "_" )
);
);
Re: How to delimit multiple column with specific string in jslThanks Paul, this solution works. I've added the for loop into the if condition statement and it solved the issues.
Names Default To Here( 1 );
dt = Data Table( "MTL");
headerList = dt << get column names( string );
For( i = N Items( headerList ), i>=1, i--,
If( Contains(headerList[i], "CLASSHOT 1"),
dt << Text to Columns(columns( Column(dt, i) ),Delimiters( "_" ));
);
);