Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
I have a document, in it there is a table that contains Dates in various forms (IE: Date, Calander Month, Calander Year,Calander Week, Financial Year, Financial Month... etc)
There are OnChange Event triggers on these fields to capture selections and change the value of 2 variables.
Like so:
v_filter_DateRangeStart= Min(<DateSelected>)
v_filter_DateRangeEnd= Max(<DateSelected>)
When these variables are changed, there is a trigger which sets the filter of the document to be "='>=' & Date(v_filter_DateRangeStart) & '<=' & Date(v_filter_DateRangeEnd)"
In the filters section of the document we have tableboxes for the fields in the date table, the idea, and how it works in the first document, is that when a selection is made in the year box (for example) this then triggers a change in the variables (v_filter_DateRangeStart, v_filter_DateRangeEnd) which in turn changes the filter on the target date field as above. There are also some input boxes which allow direct input into the variables (v_filter_DateRangeStart, v_filter_DateRangeEnd).
When typing a date into the input box, the document filters as expected. However the variables to not change when trying to use the table boxes, as it does in the other document.
I have looked everywhere i can to make sure that the document properties etc match, but there seems to be something i have missed/have forgotten.
Since creating the original document we have upgraded from QV 10 to 11.2, was somethign stopped here to forbid chaining triggers? or is there a setting somewhere which may have been turned off that i need to reactivate?
any help would be greatly recieved.
Thank you,
Chris
You have constraints on the variables. The field [Lookup Date] is formatted as a number and not a date. You need to wrap the triggers in date() in order to get them to work:
I've also attached a working example for the [Week (Calendar)] field.
yup, i knew it would be me doing something stupid like that! Although i have just checked the original, which was exactly the same as the one i sent you, so how that one works i do not know :S
Thank you so much for the help!
Hi again,
sorry to report i was a bit too eager to mark this as complete. It would appear that part of the issue has been solved. when making selections in the table boxes, the variables are now changing. However, when the variables change via this method, it appears that the trigger to filter the document is not firing and the data is not being filtered. Howevr, when i change the values in the input box manually, the data does filter.
I have checked to make sure that the triggers on the variables are cast as the right data type.
Starting to feel like im going around in circles, but its so close!!
Any help would be appreciated - the document is attached.
Okay a couple things...
This goes back to what I first said about triggers not happening in the order you expect them to in QV. To fix this, I put the triggers to filter on the same fields setting the variables, not on the variables themselves. In what I am attaching, I have fixed this for the [Week (Calendar)] field. I have added the filter triggers to both the OnSelect and OnChange options. Also note that [Lookup Date] is formatted as a number and [Operation Date] is formatted as a date, so we need to treat them differently.
I am so sorry for this, i could have sworn that was a date.
I am looking at the document you had attached, it appears that week (Calander) is not filtering the document, which is the issue i had before.
Also, can you explain why you have added and if statement? i cant quite understand what it's doing.
It does filter it if you select something valid like Week 48 (the other weeks aren't in Operation Date):
The if statement is for when you clear out the selection in the [Week (Calendar)] field. Without it, it won't clear the selections in [Lookup Date] or [Operation Date].
Thank you for explaining this, and sorry for being so dense about it all.
You have been a great help!
You're welcome
It was definitely a challenging problem to solve.