Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
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
Partner - Champion
Partner - Champion

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
Luminary Alumni
Luminary Alumni

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
Author

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
Luminary Alumni
Luminary Alumni

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
Author

jagan,

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

Not applicable
Author

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
Luminary Alumni
Luminary Alumni

Hi,

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

Regards,

Jagan.

Not applicable
Author

So i need to create any variable declaring these?

CELAMBARASAN
Partner - Champion
Partner - Champion

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)