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 column values through script window
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

amorris

Canada
Posts

Posted - 10/04/2005 :  1:06:40 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Version (Select Help-->About Origin): 7.5
Operating System: WinXP

Hi everybody,

How can I "set column values" by using the script window? Say I want col(C)=col(B)+col(A). If I do this with the script window, the operation completes successfully, but the column doesn't remember the operation. I want the equation to stay so that in the future if I want to update the column C I can just go to "set column values" dialogue box and update it from there. Can I do this?

Thanks,

Alexis

Mike Buess

USA
3037 Posts

Posted - 10/04/2005 :  1:42:24 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Alexis,

You need Origin C to change the "Set Column Values" formula. The following OC function will provide general access to a column formula in labtalk.

void setformula(string strColName, string strFormula)
{
Worksheet wks = Project.ActiveLayer();
wks.Columns(strColName).SetFormula(strFormula);
wks.Columns(strColName).ExecuteFormula();
}

Add it to your CodeBuilder workspace, compile and then use it in labtalk like this...

setformula C col(A)+col(B);

The first argument names the column for which you want to set the formula and the second argument is the formula itself.

If you need instructions for adding a function to CodeBuilder's workspace see my second post in this earlier topic...
http://www.originlab.com/forum/topic.asp?TOPIC_ID=4248

Mike Buess
Origin WebRing Member

Edited by - Mike Buess on 10/04/2005 1:49:24 PM
Go to Top of Page

amorris

Canada
Posts

Posted - 10/04/2005 :  3:30:48 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thanks Mike, that's exactly what I needed to know

Alexis
Go to Top of Page

amorris

Canada
Posts

Posted - 10/04/2005 :  4:18:34 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Mike,

I'm new to origin C, so the link that you posted to one of your previous posts was very helpful. I was wondering though, do you have to recompile the function everytime you open up a new origin session? That setformula function is very useful, and I'd like to be able to use it all the time in the script window.

Thanks,

Alexis
Go to Top of Page

Mike Buess

USA
3037 Posts

Posted - 10/04/2005 :  4:30:13 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Alexis,

1. Right click on your C-file in the Origin C Workspace and select Remove.

2. Right click on the System folder and select Add Files.

3. Locate your file in the browser and add it to the System folder.

4. Select Tools > Rebuild All to compile. From now on it will compile automatically when you start Origin.

Mike Buess
Origin WebRing Member

Edited by - Mike Buess on 10/04/2005 4:32:00 PM
Go to Top of Page

easwar

USA
1965 Posts

Posted - 10/04/2005 :  4:34:30 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

You can also just drag and drop the file to move it from the User folder to the System folder in Code Builder Tree on the left pane.

Easwar
OriginLab

Go to Top of Page

lanrus

Russia
1 Posts

Posted - 11/22/2006 :  06:56:35 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

Does somebody know, how do the topic task in Origin 6.5 without Origin C?
Go to Top of Page

Mike Buess

USA
3037 Posts

Posted - 11/22/2006 :  07:08:01 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Sorry, not possible without Origin C.

Mike Buess
Origin WebRing Member
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