Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
durgabhavani
Creator III
Creator III

Help me in writing expression for text object?

Hi All,

I have one text object and planning to display one bulb in it.

Now my challenge is

when i am selecting one date in calender then it needs to check the duedays dimension value.
If duedays value is < 10 days then my bulb needs to show green color
If duedays value is = 10 days then my bulb needs to show orange color
If duedays value is > 10 days then my bulb needs to show red color

My duedays dimesion as below
duedays
< 10 days
= 10 days
> 10 days

This is highly appreciated.

Please advise.

Thanks,
Durga

1 Solution

Accepted Solutions
ankitaag
Partner - Creator III
Partner - Creator III

Hi durga,

Please see the attached qvw.

Hope this helps or let me knowif I m missing something

script is:

script.PNG

expression of the text box

=if(Due<10,'qmem://<bundled>/BuiltIn/led_g.png' ,

if(Due=10,'qmem://<bundled>/BuiltIn/led_o.png',

'qmem://<bundled>/BuiltIn/led_r.png'))

ex.PNG

View solution in original post

11 Replies
awhitfield
Partner - Champion
Partner - Champion

Hi Durga,

something like the simple example attached, which shows a different color text box based on the seletion

Andy

jagan
Partner - Champion III
Partner - Champion III

Hi,

Please find attached file for solution.

Regards,

Jagan.

durgabhavani
Creator III
Creator III
Author

Hi Andrew and Jagan,

Sorry to say this. I have no access to qvw files in office due to security reasons.

Please share screenshots.

small change in my requirement. Please find below.

when i am selecting one date in calender then it needs to check the duedays dimension value.

If date contains only  duedays value < 10 days then then my bulb needs to show green color
If date contains only  duedays value = 10 days then then my bulb needs to show orange color
If date contains duedays value > 10 days then my bulb needs to show red color.

Finally if date is not selected by default bulb no need to show color.

My duedays dimesion as below
duedays
< 10 days
= 10 days
> 10 days

This is very helpful for my dashboard.

Waiting for reply.

Thanks,
Durga

jagan
Partner - Champion III
Partner - Champion III

Hi,

Try like this

Data used:

Data:

LOAD * INLINE [

Date, Due

1/1/2015, 8

1/2/2015, 12

1/3/2015, 10

];

Expression in Text object:

=If(GetSelectedCount(Date) = 0, Null(),

If(Sum(Due) > 10, 'qmem://<bundled>/BuiltIn/led_g.png',

If(Sum(Due) = 10,'qmem://<bundled>/BuiltIn/led_o.png',

  If(Sum(Due) < 10, 'qmem://<bundled>/BuiltIn/led_r.png'))))

Now: Text Object Properties -> Select Representation as Image.

Regards,

jagan.

ankitaag
Partner - Creator III
Partner - Creator III

Hi,

Write the expression in the textbox as

=if(Duedays<10,'qmem://<bundled>/BuiltIn/led_g.png',if(Duedays=10,'qmem://<bundled>/BuiltIn/led_o.png','qmem://<bundled>/BuiltIn/led_r.png'))

and select Image in the representation dropdown

see the attached inline

bulb.PNG

durgabhavani
Creator III
Creator III
Author

@Jagan: I am not getting changes in text object when i am selecting the date.

@Ankitha: I implement same thing as you said if i want to display the bulb based on only duedays.

but here my requirement is to display the results based on selected date. Here i am giving clear requirement. Please advice.

when i am selecting one date in calender then it needs to check the duedays dimension value.

If the selected date contains duedays value "> 10 days" (i.e may be it also contains "< 10 days","= 10 days") then my bulb must  show red color.

If the selected date contains only one duedays value "< 10 days" then then my bulb needs to show green color
If the selected date contains only  one duedays value "= 10 days" then then my bulb needs to show orange color
Finally if date is not selected by default bulb no need to show color.

My duedays dimesion already present in my dashboard as below

duedays
< 10 days
= 10 days
> 10 days

This is very helpful to my dashboard.

Durga

ankitaag
Partner - Creator III
Partner - Creator III

Hi durga,

Please see the attached qvw.

Hope this helps or let me knowif I m missing something

script is:

script.PNG

expression of the text box

=if(Due<10,'qmem://<bundled>/BuiltIn/led_g.png' ,

if(Due=10,'qmem://<bundled>/BuiltIn/led_o.png',

'qmem://<bundled>/BuiltIn/led_r.png'))

ex.PNG

durgabhavani
Creator III
Creator III
Author

Yes got it, you missed small thing. Suppose if no date is selected then bulb no need to show color. (i.e some light color)

Please advice.

Waiting for reply.

Durga

ankitaag
Partner - Creator III
Partner - Creator III

Hi,

Write the expression as

=if(GetFieldSelections(Date)>0,if(Due<10,'qmem://<bundled>/BuiltIn/led_g.png',

if(Due=10,'qmem://<bundled>/BuiltIn/led_o.png','qmem://<bundled>/BuiltIn/led_r.png')),

'qmem://<bundled>/BuiltIn/led.png')

color.PNG