Expression to Check Text Data


Badge +2

Hi ,

 

I have a list View and it has a column called Flag(Bit in Sql Server and YesNo datatype in smart object). So here I have to check something like this

 

If(Flag = 1) then "Open" else "CLOSE"

 

I tried using the expression but it is always displaying the False condition. Can anyone share their thoughts?

 

Thanks,

Yeshwanth


8 replies

Userlevel 3
Badge +8

Dear , Just to understand the scenario clearly ,

 

could u provide a screen shot for the list and a screen shot for the expression u are tryin to do .

 

Regards.

Badge +2

Hi,

 

Here is the screenshot. I tried validating to Yes/1/true but it always gives me CLOSE.

 

16212i7552BD39AD796FF8.png

 

Thanks,

Yeshwanth

Userlevel 5
Badge +16

Hi,

 

Remove the Quotation marks "Yes" => Yes/True/1. If this doesn't work then put the control it self in the condition instead of the text property.

Badge +2

Hello Mustafa,

 

Thanks for your reply. Removal of quotation Mark didn't worked out. Also i couldn't able to drag the control. It says "To avoid circular references, this element is not available for use in this expression" 

 

Regards,

Yeshwanth

Userlevel 3
Badge +8

Dear ,

 

From what i see , ur tryin to change the text of data ,as VISUAL from yes/no to open/close ,

its true u get that error because u cant add an expression on a datalabel1 and use datalabel1 inside that expression for circulations.

2 approaches u might wanna use ,

the first one which would work for sure , is to create a stored procedure in ur SQL db , and use it to generate ur list view instead of using the SMO ,

in this way  u will be able to check the value and change its text  ,

 

second approach is to add a new column into ur list view , "Data label" type , and apply the expression u have into it , and show this new column and hide the original column , in this way u will be able to use the original CONTROL inside the expression , because u r applying the expression into another control .

 

Hope it helps!

regards.

Userlevel 5
Badge +16

Hi,

 

Select the column and change the field property to None then in your expression use the field property in the condition. this should work for you.

Badge +2

Hi AhmadYakub and Mustafa,

 

Thanks for your valuable sugessions. Your ideas worked like a charm. Only one thing is that I had to convert them to Text in the expression.

 

Thanks,

Yeshwanth

Badge +2

I actully collapsed the control and chose "Text". That worked perfectly for me.

Thanks for the inspiration though!

Reply