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 |
|
|