Author |
Topic |
|
yt47106
Sweden
Posts |
Posted - 12/01/2010 : 10:58:13 AM
|
Origin Ver. and Service Release (Select Help-->About Origin): 8.5 SR1 Operating System: XP sp3
Hi,
Im importing data in CSV format and I would like to reduce the text string that is used for naming my columns, if possible already when importing the data file. In the data file all parameters are named according to their full search path: ""aaaa""/""bbbb""/""ccccc""/""ParameterName""
I would like to keep only the last part of this string; ParameterName. Can this perhaps be done by setting up some import filter or is there a better way?
Best regards, Bjorn |
|
greg
USA
1378 Posts |
Posted - 12/01/2010 : 2:24:37 PM
|
The Import Wizard can create a filter with the option to run script to post-process, so you could write script that 'fixes' the names after importing or you could mark this row as Header, parse out the pieces and write script to name the columns. Either way, you need script and the first case seems to be the easier of the two.
// BEGIN SCRIPT string str; loop(ii,1,wks.ncols) { str$ = wcol(ii)[L]$; num = str.GetNumTokens('/'); if(num > 0) { str$ = str.GetToken(num,'/')$; str$ = %[%(str$),2:%[%(str$)]]; // strip extraneous " wcol(ii)[L]$ = str$; } } // END SCRIPT
Step through the Import Wizard and check the Save Filter option (and fill in details) then check the "Specify advanced filter options" and click Next. Paste the script into the large text box and click Finish. |
|
|
|
Topic |
|
|
|