Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

Not applicable

Need help in writing expressions

I need to display a chart which should show ouput by taking run time variables. for eg two buttons are displayed, one representing qtd and other is mtd.

when i click qtd, chart should show the data based on qtd.

How do i achieve these through expressions?

Need help on urgent basis,

Thanks,

Praveen.

15 Replies
celambarasan
Not applicable

Need help in writing expressions

Hi,

     Set a variable(lets say vVariable) on click with value qtd and mtd as your requirement.

     Then write expression in chart as

     =if(vVariable='qtd',qtd expression,mtd expression)

Celambarasan

jagan
Not applicable

Need help in writing expressions

Hi,

Create two buttons for YTD and QTD, and change the variable value in

Button Properties -> Actions-> Add -> External -> Set variable (here give variable name and value);

The value should be suppose for YTD button give 'YTD' for QTD give 'QTD' and assume that variable name is  vType

Now use the following expressions

If(vType = 'YTD', Sum({<Date={'>=$(=YearStart(Max(Date)))<=$(=Today())'}>} Sales),

     Sum({<Date={'>=$(=QuarterStart(Max(Date)))<=$(=Today())'}>} Sales))

Hope this helps you.

Regards,

Jagan.

Not applicable

Need help in writing expressions

jagan,

wher do i add my expression in ur above said expression,

I am using this expression to display the value,

sum( Interval  (  DISCHARGE_TIME - ADMISSIONTIME,'hh:mm:ss')),

i need to display the same using the buttons with qtd and mtd.

jagan
Not applicable

Need help in writing expressions

Hi,

Try replacing your expression with thi

If(vType = 'YTD', Sum({<Date={'>=$(=YearStart(Max(Date)))<=$(=Today())'}>} DISCHARGE_TIME - ADMISSIONTIME),

     Sum({<Date={'>=$(=QuarterStart(Max(Date)))<=$(=Today())'}>} DISCHARGE_TIME - ADMISSIONTIME))

Regards,

Jagan.

Not applicable

Need help in writing expressions

jagan,

the above said expression is not working should i create a variable in variable overview window in settings header.

Not applicable

Need help in writing expressions

celambarasan,

What wil be the value of the variable qtd, how i do declare that, i just need the syntax. then how do i call those in my expressions?

jagan
Not applicable

Need help in writing expressions

Hi,

vType is a variable which holds the selected date type (YTD/QTD).

Regards,

Jagan.

Not applicable

Need help in writing expressions

So i need to create any variable declaring these?

celambarasan
Not applicable

Need help in writing expressions

Hi,

     You have to create a variable(like vVariable) first.

     Create 2 buttons.

     In Qtd button-->Properties-->Actions tab-->Add button-->Select external--> choose Set variable.variable name vVariable value as ='qtd'

     Same for ytd button but variable value as ='mtd'

Then in chart wrote expression as

     =if(vVariable='qtd',qtd expression,mtd expression)