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
 Forum for Origin C
 A few questions related about "column"

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
kanderlee Posted - 10/03/2007 : 04:00:55 AM
Origin Version : 7.5 SR4
Operating System: XP SP2

There are a couple of questions about column as following:

1. How can I do for setting the cloumn's name as a part of its filename? For instance, If I import an ASCII file named "testabcd0010.dat", and I just want to set the column's namne of the file to "010mA".

2. I would like to use the function of "set column value" in worksheet if someone want to use my code to process his/her data, but he/she fears or doesn't know how to modify the code if he/she have to insert some equations in the column to calculate something. I've tried to set "set column value" in one template of worksheet, and my code recall the template while I am importing ASCII files. All setting of the template were working fine expect "set column value". It seems no any affects to the column. However, when I open the dialog box of "set column value" again in worksheet after running my code, it was just right there and worked correctly after I closed the box! I'm so confused why my code couldn't let the function in the "set column value" dialog box to work?

I'm sorry about that saying too many words in the questions, I just tried to describe the more detail situation I met to help someone if he/she would try to know my questions. Thank you for finishing reading the questions with patience.

Kander Lee
5   L A T E S T    R E P L I E S    (Newest First)
kanderlee Posted - 10/31/2007 : 05:42:53 AM
Mike,

How can I do if I want to set graphpage's name as the column's name which the graph used to plot from? Thank you.
kanderlee Posted - 10/08/2007 : 10:25:04 PM
Thank you, Mike. Your code is more efficient than mine. It works great!
Mike Buess Posted - 10/04/2007 : 10:40:23 PM
quote:
but I don't know how to use "string::GetToken", even after reading the example in the help of Origin C.
GetFileName(strFile,true) already strips the file extension so there's no need to use GetToken.

quote:
How to put the correct name of the column in Origin "set column value" into my code if I have to change the column's name in my code? Can I use" column::GetName()" in the formula of "Column::SetFormula"?
Yes, that could work but you already know the column name and you can also use the column number...

strLabel = GetFileName(strFile, true);
string strCol = strLabel.Right(3) + "mA";
BOOL b = wks.Columns(i+1).SetName(strCol);

Column dsCX1(wks,i+1);
string strFormula;
strFormula.Format("col(%d)^2 + 15698", i+2); // use (LabTalk) column number
// or strFormula.Format("col(%s)^2 + 15698", strCol); // use column name
dsCX1.SetFormula(strFormula);
dsCX1.ExecuteFormula();

Mike Buess
Origin WebRing Member

Edited by - Mike Buess on 10/04/2007 11:27:05 PM
kanderlee Posted - 10/04/2007 : 9:38:21 PM
Thank you, Mike.

I am able to use "string::Right", "Column::SetNameˇ¨,and "Column::ExecuteFormula " properly, but I don't know how to use "string::GetToken", even after reading the example in the help of Origin C.

There is also another question here. How to put the correct name of the column in Origin "set column value" into my code if I have to change the column's name in my code? Can I use" column::GetName()" in the formula of "Column::SetFormula"?

For example of a part of the loop in my code:


string strLabel = GetFileName(strFile, TRUE );
string strCol= strLabel.Right(3);
strCol.Insert(3,"mA");
BOOL b = wks.Columns(i+1).SetName(strCol);

Column dsCX1(wks,i+1);
dsCX1.SetFormula("dsCX1.GetName()^2 + 15698");
dsCX1.ExecuteFormula(-1, -1);


I don't know that is the correct way to use "Column::SetFormula" or not?
Mike Buess Posted - 10/03/2007 : 09:40:15 AM
1. Use string::GetToken to strip the file extension, string::Right to get the 3 rightmost characters and Column::SetName to change the column name.

2. Use Column::SetFormula to set the column formula and Column::ExecuteFormula to execute the formula.

Mike Buess
Origin WebRing Member

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