Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I'm new to QlikView, primarily being a C#/SQL developer. I have a Straight Table chart with some data, including a specific date that I want to filter on. My requirements are that I'm to add a widget to allow the user to select a start/end date range.
I have created two Slider/Calendar objects, set to Calendar for the display type. I have the following code in my Script (names have been anonymized) for the date variables:
/* Start of Script */
Date_Range:
LOAD
Date(Max(Deduction_Date)) AS Max,
Date(Min(Deduction_Date)) AS Min
RESIDENT Deductions_Table;
LET vMax = Date(Peek('Max', 0, 'Date_Range'), 'MM/DD/YYYY';
LET vMin = Date(Peek('Min', 0, 'Date_Range'), 'MM/DD/YYYY';
LET vStartDate = '';
LET vEndDate = '';
/* End of Script */
Assume that Deductions_Table is a straightforward SQL select of some rows in a database table that just loads the information into Qlik. My calendar controls are set to Variable(s) with the correct variable specified for each and I have verified through the use of an Input Box control that they are populating when I select a date.
On Document Properties, under the Triggers tab, I have added actions for vStartDate and vEndDate as follows:
OnChange -> Select in Field
Field: Deduction_Date
Search String: ='>=' & vStartDate & '<=' & vEndDate
What I would expect to happen is if I select a start date of 4/1/2016 and an end date of 4/5/2016 that my chart will filter to only records where the Deduction_Date field falls within that range. However, it doesn't seem to be filtering at all and I see dates that are from, using the prior example, 3/1/2016 even though I have the date range specified as 4/1/2016 - 4/5/2016. I have a tab with a "data dump" of the records and can see that the Deduction_Date list box is NOT showing any filters applied when I change the dates in the calendar control.
I am clearly missing something, but I am not sure what. Any advice?
Thanks and regards,
Wayne Molina
Your variable definitions are missing the closing parentheses of the Date() function
LET vMax = Date(Peek('Max', 0, 'Date_Range'), 'MM/DD/YYYY' ) ;
LET vMin = Date(Peek('Min', 0, 'Date_Range'), 'MM/DD/YYYY' ) ;
i think closing braces...am n sure
I thing you miss the Closing Barces on vMax and vMin variables.
I might have just fat-fingered that since I didn't copy it. In the script editor it is:
LET vMax = Date(peek('Max', 0, 'DataRage'), 'MM/DD/YYYY');
LET vMin = Date(peek('Min', 0, 'DataRage'), 'MM/DD/YYYY');
Which looks like it has the right closing brace.