Your task should be fairly easy and straight forward. What you need to do is set up a field, preferrably in a secondary data source, which is your filter field.
Let's assume the following:
- TaskFilter is the name of your filter field.
- The values 0, 1, 2 represent Overdue, Due and Completed tasks respectively.
- Status is the name of the field holding the status of each task.
- btnOverdue, btnDue, btnComplete and btnAll are the IDs for your buttons.
Here is what you would do to get your buttons working to auto-filter your table.
Set up the filter on your table:- Add a filter to your table with the following two conditions:
- TaskFilter, Is Blank
- OR
- Status, Is Equal To, TaskFilter
- Clear the Show Filter Icon To Indicate Filtered Items checkbox.
Create rules for your buttons:- Create a Rule for btnOverdue which sets the value of TaskFilter to 0.
- Create a Rule for btnDue which sets the value of TaskFilter to 1.
- Create a Rule for btnComplete which sets the value of TaskFilter to 2.
- Create a Rule for btnAll which clears the value of TaskFilter.
Do not add the TaskFilter field into the view -- this is strictly for behind the scenes.
Preview your form and test your buttons.
Greg Collins [InfoPath MVP]