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
 Using variables
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

RockerSWE

Sweden
6 Posts

Posted - 03/31/2010 :  03:05:39 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hello,

When running the import wizard (from asci data files), I set the header and variables to be extracted from the header. This works fine.

I would then like to run a script which takes the variable value, and multiplies it with a column and puts the result in a new column. For example, if the variable is named "T", I tried:
wcol(4)=T*wcol(3)
This does not work. Is it possible to do this using scripting only?

Origin Ver. and Service Release (Select Help-->About Origin): 8.0
Operating System: Win Vista

larry_lan

China
Posts

Posted - 03/31/2010 :  04:55:11 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Maybe is the scope of the variable? And you should avoid use the variable name T, maybe TT instead.

try:

ty "The value of TT is $(TT)."
wcol(4)=TT*wcol(3);


To see if TT is valid.

Larry

Edited by - larry_lan on 03/31/2010 04:57:19 AM
Go to Top of Page

RockerSWE

Sweden
6 Posts

Posted - 03/31/2010 :  05:00:14 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
I get the following message:
"The value of TT is --."

(It should be 400)
Go to Top of Page

larry_lan

China
Posts

Posted - 03/31/2010 :  05:48:32 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
The variables you extract from header are saved as string, and you cannot use them directly by their name. You can open Workbook Organizer to see how to access the variables by tree. It should looks like page.info.user.variables.varName$. Supposed there is a variable named TT, you can change the script into:

// Extract the variable, and convert into double
double tt = %(page.info.user.variables.TT$);
ty "TT is $(tt)";
wcol(3) = tt*wcol(2);


Hope this helps.

Larry
OriginLab Technical Services
Go to Top of Page

RockerSWE

Sweden
6 Posts

Posted - 03/31/2010 :  07:28:15 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
That worked! Thanks for your help.
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