Affect other model conditions from a table date range filter

This is an interesting conundrum. You are right, our date range filters do not let you affect other conditions. (That would be really cool…) and your diagnosis of the model action stragety is also right on the money. The query action already resets the table before the subsequent conditons are set…

But there is another way! It calls for our arbitrary filter model. Its been discussed a few times on the forum. But I’ll build it up for you here.

1: Conditions: I assume that the conditions are the start date and end date of two different date fields. They should be tied together with a logic statement that looks like (1 AND 2) OR (3 AND 4) - so that records will be retunred if the dates requested are in either field.

2: Second Model: Create a model that will serve just to provide date fields. As long as the fields are the same type as the ones driving your conditions it can be any ojbect. (Don’t try to mix dates with date/times)

  • The model should be set to “Create default row” and NOT set to “Load Data” We won’t save this data.
  • Choose two date fields.

3: Build a popup: We reproduce the filter control by building a popup in a global action on the table. (You could do this in other ways…). The popup has a field editor built on this new model.

  • It is set to Edit Mode and has the two date fields.
  • Remo the save and cancel

Add a page title component below the field editor. It should also have the new model as its driver. Remove the two text areas, but add two buttons. One will be our Filter button. The other will Cancel.

4: Configure the Page Title Buttons. Each page title button will be a sequence of actions.

Filter button starts with 4 actions, where the conditions set in step one are activated, and the start date is passed into conditions 1 and 3, and the end date is passed into conditions 2 and 4. The final action will be to query your main model.

Clear button does exactly the same, but instead of activating the conditions, it de-activates them, and then queries the model.

And that is it. It should be beautiful…

Just remember that you can’t try to filter date/time fields by passing date values into them. That has to line up…