This is a migrated thread and some comments may be shown as answers.

How to use an enum to evaluate a value ?

1 Answer 302 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Cantenot Frederic
Top achievements
Rank 1
Cantenot Frederic asked on 23 Feb 2011, 03:18 PM
Hi,

I would like to use an expression like that in a report :
=IIF(Fields.ItemType <> "Value", Format("{0:P1}", Fields.Value1), Format("{0:## ### ###,}",Fields.Value1))

This expression is in the property 'value' of a textbox. The textbox is inside a 'Table'

Inside the report, I have a message which is : "an error occured while"

'ItemType' is a property of an object which is bound. It's also an enumeration which can contains 'None, Value or Pourcent'

So, if my object's properties contain pourcents, I would like to format my values in a certain way and if my object's properties contain values, I would like to format my values in another way.

Is it possible to do it when an enumeration is evaluate ?
What is wrong inside my expression ?

Thanks for your help.

Regards.

Fred

1 Answer, 1 is accepted

Sort by
0
Cantenot Frederic
Top achievements
Rank 1
answered on 24 Feb 2011, 02:43 PM
I found how to to it. With a ToString().

=IIF(Fields.ItemType.ToString() <> "Value", Format("{0:P1}", Fields.Value1), Format("{0:## ### ###,}",Fields.Value1))

It almost works like i want.
Tags
General Discussions
Asked by
Cantenot Frederic
Top achievements
Rank 1
Answers by
Cantenot Frederic
Top achievements
Rank 1
Share this question
or