Note: You must be registered in order to post a reply. To register, click here. Registration is FREE!
T O P I C R E V I E W
asdfghjkllkjhgfdsa
Posted - 06/30/2012 : 10:15:29 AM Hi, I am very new in originC. can anyone help me in the following? I want to do set column values using a script in originC.
I am able to do things like col(A)+col(B). or col(A)+constant.
but I am not able to do,
col(A)-value; where "value" is a variable in my program.
This might be very trivial. Can any one please help?
Worksheet wks2("[Book1]nlfitpeaks1"); double value; Worksheet wks_report = wks2; if( wks_report ) { uint uid; Tree tr; if( wks_report.GetReportTree(tr, &uid, 0, GRT_TYPE_RESULTS, true) ) { string strOut; tree_to_str(tr, strOut); // translate from result tree to string, print this string you will see it as a table format out_str(strOut);
out_tree(tr);
if(tr.Parameters.xc.Value.IsValid()&&tr.Parameters.xc.error.IsValid()) { value = tr.Parameters.xc.Value.dVal; double valueErr = tr.Parameters.xc.error.dVal; // printf("\t value1 = %f, Error1 = %f\n",value,valueErr); } else { double value = 1000000000; printf("\t DO value is not correct = %f\n",value); }
} }
// I want to use The variable "value" in the formula like: col(A)- value;
1 L A T E S T R E P L I E S (Newest First)
Penn
Posted - 07/01/2012 : 10:27:51 PM Hi,
Please try something like:
Column col;
col.Attach(wksTarget, 2);
double value = 2.0; // assume value = 2.0
string strFormula = "col(A) - " + value; // construct a formula string
col.SetFormula(strFormula, AU_AUTO);
col.ExecuteFormula();