Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Docment triggers on selecting a value in a field

Hi All,

Is it possible to set the variables through Document triggers when a value in the field is selected?

I have a Year field which has four values.2011 to 2014. requirement is- when a value in the year field is selected, lets say when i select 2014,the variables vStartDate should get the value 01/01/2014(YearStart) and vEndDate should get the value 12/31/2014(YearEnd).

values should change accordingly when different year is selected. these variables are used further in the Set Analysis for YTD calculations.

I have tried the document triggers->field event trigger->OnSelect triggers. it is not giving me proper results. i have attached the sample. please help me resolve this.

Thanks a lot in advance.

Jyothi

1 Solution

Accepted Solutions
kavita25
Partner - Specialist
Partner - Specialist

Hi Jyothi.

Is this ur requirement? Check the given application.

Regards,

Kavita

View solution in original post

8 Replies
kavita25
Partner - Specialist
Partner - Specialist

Hi Jyothi.

Is this ur requirement? Check the given application.

Regards,

Kavita

jonathandienst
Partner - Champion III
Partner - Champion III

Hi

Rather than using triggers, define dynamic variables like this.

Defined these in script using: (the double = is not a typo)

Set vStartDate = =MakeDate(Max(Year), 1, 1);

Set vEndDate = =MakeDate(Max(Year), 12, 31);

or define in the variable overview (the = is part of the variable)

vStartDate::                  =MakeDate(Max(Year), 1, 1);

vEndDate::                   =MakeDate(Max(Year), 12, 31);

HTH

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Not applicable
Author

Hi Kavita,

Thanks.. Thats what i wanted.. Could you explain how u did it?

kavita25
Partner - Specialist
Partner - Specialist

Hi,

I just created two variables as per ur requirement u wanted Start Date  and EndDate of the selected year.

As you don't have Date field, I used MakeDate Function.

For Start Date : Makedate( Year,1) for Jan

For End Date : Makedate (Year, 12) for Dec

ecolomer
Master II
Master II

Here you have my proposal

p02.png

Not applicable
Author

Thank you

Is it possible to default the variables to current year start till Today() when the year selection is cleared?

ecolomer
Master II
Master II

Yes, here you have

What is the best response?

kavita25
Partner - Specialist
Partner - Specialist

Yes..

For Start Date : Makedate( max(Year),1) for Jan

For End Date : Makedate (max(Year), 12) for Dec