We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Variables within a formula

Dear Sirs,

Is there any way I can add/set the index (business objects) from within a formula.

E.g. I want to be able to set a variable [A] to a value from within the formula, set a variable [B] and then set a [C] with the sum of [A] and [B] - all this from within the formulas.

I've tried making my own functions, SetVar that adds to the indexer

SetVar(A,10)
SetVar(B,20)

[A]+[B] gives 30 ... so that works...

But

SetVar(C, [A]+[B])
[C]

Gives:

bA1A2ab ??????


What do I do?


Best Regards,
- Henrik Brinch

1 Reply

AD Administrator Syncfusion Team February 14, 2007 01:30 PM UTC

bA1A2ab is the parsed version of [A]+[B]. If you evaluate bA1A2ab (by calling calcquick.Engine.ComputeValue("bA1A2ab"), you should get the sum of 10 and 20.

You did not post your SetVar, but if you somehow do the equivalent of

calcQuick["C"] = "=[A]+[B]";

then I think it should work. Here is a snippet that works as expected for me inside a button handler.

Syncfusion.Calculate.CalcQuick q = new Syncfusion.Calculate.CalcQuick(true);
q["A"] = "10";
q["B"] = "20";
q["C"] = "=[A]+[B]";

this.label1.Text = q["C"]; 'shows 30



Loader.
Live Chat Icon For mobile
Up arrow icon