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 for Programming
 LabTalk Forum
 Set equation for set column value + auto update
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

JBrueckner

Germany
2 Posts

Posted - 05/27/2014 :  08:24:36 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.6.0G
Operating System: Win7

Hello,

I wrote a Labtalk script where I import two columns of data from a csv, after which I calculate col(C) from col(a) and col(b).
I execute the script by typing "run imp.ogs" in the command window.
The following script works fine:

newbook dataimport; 
wks.ncols=2;

impCSV fname:="H:/data.csv" options.decimal:=1 options.HeaderLines.SubHeaderLines:=1 options.HeaderLines.LongNames:=1;

page.active=1;
wks.name$=rawdata;
wks.colwidth = 2;

%A = "dataimport"; 
window -r %H %A;

//copy data 1st data set
newsheet name:=data0 cols:=2;
wks.labels(LUCD1);
page.active=1;
colcopy irng:=(1:2) orng:=[dataimport]data0!(1:2) data:=1 format:=1 lname:=1 units:=1 comments:=1;
page.active=2;wks.colwidth = 3;

col(C) = col(B)/col(A)*100;


However it doesn't show the equation for col(c) when I right-click on col(c) and go to set value...
I want col(c) to update automatically and remember the equation when I manually add new lines to col(a) and col(b).
How is that possible?

Thank you very much,
Jan

lkb0221

China
497 Posts

Posted - 05/27/2014 :  09:49:47 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

To keep the formula and create green lock for auto update, you need to use the following X-function:
http://www.originlab.com/doc/X-Function/ref/csetvalue

Zheng
OriginLab
Go to Top of Page

JBrueckner

Germany
2 Posts

Posted - 05/27/2014 :  11:33:43 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hello Zheng,

thank you very much for your quick responds.
Your solution works great!

Thank you very much,
Jan
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