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
 All Forums
 Origin Forum for Programming
 LabTalk Forum
 access column/calculate values dialog box in scrip

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
normanja Posted - 02/02/2006 : 2:56:20 PM
Origin Version (Select Help-->About Origin): 7.5g sr3
Operating System: WinXP pro

Hello!

I have a script which I use to import ascii data files with several columns. I name them, erase a few f them and create new ones (and calculate the values therein). Now I want to create new columns which have a formula in them like col(E)=col(C)*col(D) which is autoupdated, i.e. when I change the values of col(D) I do not want to newly calculate col(E), but the program should do it itself. One can access tis kind of functionality through the drop-down menu column/calculate values, enter the formula there, activate autoupdate and it works.

But I want my script to do this for me on 50 freshly mportet datasets (worksheets).

Thanks for your help, appreciated, Norman Schmidt.
3   L A T E S T    R E P L I E S    (Newest First)
Mike Buess Posted - 06/02/2006 : 5:15:00 PM
The original expression also uses proper LabTalk syntax and works fine in my tests. When calling an OC function from LabTalk you can omit the parantheses around the arguments as long as you also omit the commas separating the arguments. In general, parentheses are only needed in LabTalk when you expect a return value. See the following section of Help > Programming...

Programming Guide > Programming in Origin C > Calling Origin C Functions > Calling Origin C Functions from LabTalk

Mike Buess
Origin WebRing Member
normanja Posted - 06/02/2006 : 11:51:37 AM
correctly, in Labtalk it has to be


SetColumnFormula(E, "col(C)*col(D)");

Otherwise, it is working great. Thanks!
Mike Buess Posted - 02/02/2006 : 5:25:56 PM
You need Origin C to access the column formula. First, add the SetColumnFormula function at the bottom to your workspace...
http://www.nmrtools.com/labtalk/tryOC.html

Then use it in a LabTalk script like this...
SetColumnFormula E "col(C)*col(D)";

// Function starts here
void SetColumnFormula(string colName, string strFormula)
{
Worksheet wks = Project.ActiveLayer();
wks.Columns(colName).SetFormula(strFormula);
wks.Columns(colName).SetFormulaAutoUpdate();
}


Mike Buess
Origin WebRing Member

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000