CASE or IF statement in Datacolumn.Expression

CASE or IF statement in Datacolumn.Expression

Post by jellin » Mon, 29 Oct 2007 09:54:07


Hi,

Is it possible to use a CASE or IF ELSE statement in a datacolumn
expression?

Here's what I've tried:

'standardCodeColumn.Expression = "CASE StandardsBodyID
WHEN 1 THEN 'JCAHO' ELSE 'Non-JCAHO' END"
'standardCodeColumn.Expression = "CASE WHEN
StandardsBodyID = 1 THEN 'JCAHO' ELSE 'Non-JCAHO' END"

But I keep getting errors like this:

Syntax error: Missing operand after 'StandardsBodyID' operator

Please help if you can. I know we can do this at the SQL View level
but its a requirement in this case to move that logic to the BLL/DAL
layer.

Thank you,

.jelling
 
 
 

CASE or IF statement in Datacolumn.Expression

Post by Jack Jacks » Mon, 29 Oct 2007 12:17:51

On Sun, 28 Oct 2007 00:54:07 -0000, jelling < XXXX@XXXXX.COM >



The Help for Expression pretty clearly explains what is legal:

< http://www.yqcomputer.com/ ;

It looks like IIF() will do what you want.