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
 Forum for Origin C
 Set column values: help needed.
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

asdfghjkllkjhgfdsa

India
Posts

Posted - 06/30/2012 :  10:15:29 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
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?

thanks.

I Post a part of the program here:

Column col;
col.Attach(wksTarget, 3);
col.SetFormula("col(B)-col(C)", AU_AUTO);
col.ExecuteFormula();


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;

Penn

China
644 Posts

Posted - 07/01/2012 :  10:27:51 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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(); 


Penn
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