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
 Import Wizard - seperator problems
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

Bladilu

10 Posts

Posted - 10/29/2010 :  05:03:28 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. 8.1 and Service Release SR1 Operating System:XP

Hi Guys ,

iam having Problems importing some .txt Date into Origin .
The Data looks like that :
##Temp./C,E'/MPa(50.00Hz),E'/MPa(20.00Hz),E'/MPa(10.00Hz),E'/MPa(5.00Hz),E'/MPa(2.00Hz),E'/MPa(1.00Hz),tand(50.00Hz),tand(20.00Hz),tand(10.00Hz),tand(5.00Hz),tand(2.00Hz),tand(1.00Hz) 
 -40,00000  ;  1794,12671;  1774,58948;  1756,88953;  1739,56030;  1720,39282;  1707,24609; 6,34108E-02; 5,43609E-02; 4,49786E-02; 4,38529E-02; 4,23635E-02; 4,19082E-02


My problem is ,that i can choose only one seperator in the wizard,
but the seperators for the longname and the values are different.

Regards Bladilu

eparent

118 Posts

Posted - 10/29/2010 :  3:14:19 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
The Import Wizard does not support the ability to specify unique delimiters at that level. You can however choose ';' as your delimiter which will import the data correctly and put the entire long name row into the first column's Long Name. Then, in the filter's post script you can use the following code to parse the imported long name row and set the long names for all your imported columns.

string names$ = col(1)[L]$;
int c = 1;
int delim = names.Find(",");
for (;delim > 0;)
{
    col($(c))[L]$ = names.Left(delim - 1)$;
    c++;
    names.Delete(1, delim);
    delim = names.Find(",");
}
col($(c))[L]$ = names$;
wcolwidth irng:=1! width:=10;

Edited by - eparent on 10/29/2010 3:27:12 PM
Go to Top of Page

Bladilu

10 Posts

Posted - 11/02/2010 :  11:16:29 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thx eparent , worked fine !
Go to Top of Page

Bladilu

10 Posts

Posted - 11/16/2010 :  03:50:55 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi its me again ,

i realized that this seperator problem ocurs realy often .
Could someone explain this script which eparent posted?

thx
Go to Top of Page

eparent

118 Posts

Posted - 11/16/2010 :  11:25:35 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Here is the script code again, but this time I have added comments to explain the purpose of each line. If something is still not clear please let me know.


// Copy Long name from column 1 to a local string variable.
string names$ = col(1)[L]$; // 1=col index, L=Long name row

// Use 'c' for our column index, init to 1 (first col).
int c = 1;

// Use 'delim' for comma positions, init to index of first comma.
int delim = names.Find(",");

// Keep looping as long as we find a comma.
for (;delim > 0;)
{
    // Set column's Long name to part of string before the comma.
    col($(c))[L]$ = names.Left(delim - 1)$;

    // Increment column index.
    c++;

    // Delete the part of string before and including the comma.
    names.Delete(1, delim);

    // Find the next comma in the remaining string.
    delim = names.Find(",");
}

// Whatever remains in the string is the last long name.
col($(c))[L]$ = names$;

// Call the 'wcolwidth' X-Function to resize all the columns
// so they are wide enough to read their long names.
wcolwidth irng:=1! width:=10;

Edited by - eparent on 11/16/2010 11:26:15 AM
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