The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum
 Origin Forum
 Reduction of text string for nameing column
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

yt47106

Sweden
Posts

Posted - 12/01/2010 :  10:58:13 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
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  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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.
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000