What is the syntax in Expression Assistant for the following example: I have a data field that contains either a Y or an M. If there is a Y, I want the report to say "Years", and if it is an M, I want the report to say "Months".
Hi Sylvia,
You may use an expression like this one (replacing "MyField" by your data field name)...
=If(MyField.ToUpper() ="Y", "Years", If(MyField.ToUpper() ="M", "Months", MyField))
The IF(boolExpression, thenExpression, elseExpression) function it's located at the "Other" functions category on Expression Assistant
Regards,
CJC
Ok. That worked. Thanks!
But - I don't know how in the world I would have figured that out myself. Is there documentation on this somewhere? Or perhaps this syntax is patterned after some programming language I'm not familiar with?
Hi Sylvia, im apologize about the delay...
You can found useful info about that on "About Expressions" section, and "Constants, Operators and Functions supported by Expressions" apendix of CTP Documentation (see InfragisticsNetAdvantageReportingCTPUserGuide.pdf on product instalation folder or infragistics/netAdvantage2011.2/Reporting program group).
By the way, on V1 release, Expression Assitant will show in-place brief description for each selected function.
I had seen those; but I didn't understand the structure of the If statement you sent me. I think I see now though, that you just put another If statement within the ReturnedFalse path of the first if statement.
Since I am not a C# programmer, more examples of expressions in the documentation would definitely be helpful.
Thanks so much.
OK...
I will talk with the Product Guidance team to take care about that...
The IF expression structure it's:
IF(booleanConditionExpression, anyExpressionForThenCase, anyExpressionForElseCase)
the IF expression evaluates to anyExpressionForThenCase or anyExpressionForElseCase according to the result of booleanConditionExpression..
so, as anyExpressionForThenCase and anyExpressionForElseCase are both any valid expression... you can uses IF's (nested) for these.