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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Expression Columns

Thread ID:





63854 Jul 10,2007 09:58 PM UTC Jul 10,2007 10:44 PM UTC WinForms 1
Tags: Grouping
Asked On July 10, 2007 09:58 PM UTC

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"


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

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.


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.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon 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.Close Icon