Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to write Expression in Text Object


Hi,

I am using a Text object to display, either a green "Check" image, if the expression is TRUE, and same Text object must display a red "X" image if the expression is not true. I included this logic in the "Text" right mouse click -> Properties -> General tab -> Edit Expression box, but it does not work. I may not be using the right syntax. Can someone please suggest?

Table1:

Load

* INLINE [
Room, Error

Room 1, 0

Room 2, 0

Room 3, 1];

The table looks like this:

RoomError
Room 10
Room 20
Room 31


I selected a "Text" object. In text object "Properties" -> General tab -> within "Text" box, I want to type an expression or logic in the text object, that displays:

     a green check image, if Room = Room 1 and Error = 0, otherwise the object will display a Red X image

Similary, there will be three separate Text objects for three rooms. Room 1 and Room 2 will display green checks and Room 3 will display red X.

Expression for green checkbox = 'qmem://<bundled>/BuiltIn/check_g.png','qmem://<bundled>/BuiltIn/cross_r.png')

Expression for red X = 'qmem://<bundled>/BuiltIn/cross_r.png'

This logic works in other Chart Type. I am able to execute this expression in Chart, by selecting Guage chart type, and in Properties select horizontal Traffic Light "Style".

Dimension: =if([Room]='Room 1',[CV-190 Room])

Expression: Error

This works perfectly, but it gives me only Round green and Round Red options. I prefer to use the green Check image and Red X image that is already available in "Edit Expression" -> "Images" tab

Thanks in advance

1 Solution

Accepted Solutions
fred_s
Partner - Creator III
Partner - Creator III

You could do something like this:

=if(sum({<Room={'Room 3'} >} Errorx) > 0, 'qmem://<bundled>/BuiltIn/cross_r.png' , 'qmem://<bundled>/BuiltIn/check_g.png')

Grtz Fred

View solution in original post

7 Replies
fred_s
Partner - Creator III
Partner - Creator III

Hi Raghavendra,

Change representation to image and try again.

Grtz Fred

rooms.JPG

Not applicable
Author

Hi Fred,

Thanks for your quick response. I am already using Image "representation". I want to know the syntax that can be used in the "Text" box field that is located above the "Representation" field. The logic must do following:

If((Room = 'Room 1') and (Error = 0), 'green checkbox', 'red x').

Raghu

fred_s
Partner - Creator III
Partner - Creator III

You could do something like this:

=if(sum({<Room={'Room 3'} >} Errorx) > 0, 'qmem://<bundled>/BuiltIn/cross_r.png' , 'qmem://<bundled>/BuiltIn/check_g.png')

Grtz Fred

Not applicable
Author

Hi Fred,

I used following:

=

if(Sum({<Room={'Room1'} >} Error) =0, 'qmem://<bundled>/BuiltIn/check_g.png','qmem://<bundled>/BuiltIn/cross_r.png')

I get the green check, but when I replace Room1 with Room3, I am supposed to see Red X, but instead I see green check.

The three Text Objects for three rooms must display:


Check.jpg

Thanks,

Raghu

fred_s
Partner - Creator III
Partner - Creator III

Try 'Room 3' (space between Room and 3) instead of 'Room3'.

Grtz Fred

Not applicable
Author

Hi Fred,

Thanks for your earlier suggestions.

The following works:

=

if(sum({<Room={'Room 1'}>} Error) =0, 'qmem://<bundled>/BuiltIn/check_g.png','qmem://<bundled>/BuiltIn/cross_r.png')

Thanks,

Raghu


fred_s
Partner - Creator III
Partner - Creator III

Please mark this question as answered.

Thanks