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.
Unfortunately, activation email could not send to your email. Please try again.

Variables within a formula

Thread ID:

Created:

Updated:

Platform:

Replies:

56387 Feb 14,2007 07:06 AM Feb 14,2007 08:30 AM Windows Forms 1
loading
Tags: Calculate
Henrik Brinch
Asked On February 14, 2007 07:06 AM

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

Administrator [Syncfusion]
Replied On February 14, 2007 08:30 AM

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



CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;