PDA

Click to See Complete Forum and Search --> : [RESOLVED] DataColumn Expression


nebulom
Dec 4th, 2005, 08:52 PM
How do I express a DataColumn to have a value of conditioned from another DataColumn. This is my case, I have a DataColumn("IsInactive") that receives 1 if true and 0 if false. Now, I have a DataColumn("Status") to receive a value "Active" if DataColumn("IsInactive") is 0 and "Inactive" if DataColumn("IsInactive") is 1.

DataColumn("Status").Expresison = "Need help here!";

Needing help,
NEBZ

Thanks very much.





Added [RESOLVED] to thread title - Hack

scavenger
Dec 4th, 2005, 10:06 PM
FYI...DataColumn.Expression Property (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemdatadatacolumnclassexpressiontopic.asp)


IIF
Description Gets one of two values depending on the result of a logical expression.
Syntax
IIF(expr, truepart, falsepart)

Arguments

expr-- The expression to evaluate.

truepart-- The value to return if the expression is true.

falsepart-- The value to return if the expression is false.

Example: myDataColumn.Expression = "IIF(total>1000, 'expensive', 'dear')


Hope this helps!

nebulom
Dec 5th, 2005, 12:00 AM
Millions of thanks.