T O P I C R E V I E W |
RockerSWE |
Posted - 03/31/2010 : 03:05:39 AM 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
|
4 L A T E S T R E P L I E S (Newest First) |
RockerSWE |
Posted - 03/31/2010 : 07:28:15 AM That worked! Thanks for your help. |
larry_lan |
Posted - 03/31/2010 : 05:48:32 AM 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 |
RockerSWE |
Posted - 03/31/2010 : 05:00:14 AM I get the following message: "The value of TT is --."
(It should be 400) |
larry_lan |
Posted - 03/31/2010 : 04:55:11 AM 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 |