Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
braham
Creator
Creator

Calculating a variable from an input field

Afternoon everyone,

I am sure I am missing something very straightforward, so some assistance would be appreciated.  In my load script I load a master calendar, Which has a range of dates corresponding to the range of dates in the transaction file, plus the number of the week in the year. The date links to a date field in the transaction file I am loading.  I want the user to enter a date (any date in the range of the master calendar) which I store in a variable I called 'vInputDate'. Based on the date the user enters I want to assign a variable the corresponding value of the week variable. 

So if the user enters 12/12/2020, I want the week variable to reflect 50, and if the user enters 16/12/2020 I want the week variable to reflect 51. This needs to be done dynamically as the user can select whichever date he wants to report on.

Thanks, always appreciate the input from this forum.

Regards

Braham

 

Labels (2)
2 Replies
rubenmarin

Hi @braham, I'm not sure to undesrtand... in document properties -> triggers -> vriable events, you can select the vIndputdate variable and add actions for this variable value seet or changed, this actions can change to week variable (Actions ->external -> set variable).

braham
Creator
Creator
Author

Hi @rubenmarin , Thanks for the suggestion. I have not worked with triggers, so this solution would be new to me. I did however find a solution. I defined another variable (vInputWeek) to be:

Max(If($vInputDate)=TableDate, MasterCalendarWeek). When the vInputDate is updated the value of this variable changes to the correct week number. I can now use that to report on.