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.

Expression Columns

Thread ID:

Created:

Updated:

Platform:

Replies:

63854 Jul 10,2007 05:58 PM Jul 10,2007 06:44 PM Windows Forms 1
loading
Tags: Grouping
Andy
Asked On July 10, 2007 05:58 PM

Syncfusion 5.1
VS 2005

Can we create expression columns using conditional statements? For instance, can we use the expression
"IF [COL1]=1 THEN [COL2]*2 ELSE [COL2]*10"

Thanks

Administrator [Syncfusion]
Replied On July 10, 2007 06:44 PM

This is no built-in support for IF statements in an Expression column. But you can use the fact that logical expressions return 1 or 0 depending upon whether they are tru or not to write an expression that is thye equivalent of an IF statement using a linear combination of the true alternative and the false alternative weighted by the logical expression.

"([Col1] = 1) * ([Col2] * 2) + (1 - ([Col1] = 1)) * ([Col2] * 10)"


Another way is to use an unbound column instead of an expression column. In your QueryValue code that defines the value for the unbound column, you can write code to compute any value you want from the e.Record that is passed in.

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.

;