Models with Conditional "Conditions": Create New models or Default off Filterable conditions

Hi,

This is something that came up and could not find the Recommended way to do this.

I have a model Named Bank Statements.

For certain tabs,popup,tables… I want 1+ specific condition to be applied (example for popup show me only most recent month’s statement)

Should I:

A) Clone the model bank statement for each set of conditions (worried it may slow down the loading of page with so many models…)

B) Create Default Off Filterable conditions, and enable it before popup. Or for a tab to use the Actions when first shown and Whenever shown to Enable condition?

C) A better way, I had no thought off?

For me I think Solution B made the most sense. So i Tried it for a button with 2 actions.
1st action: Activate the model Condition
2nd action: Show popup

I expected the results in popup  to be filtered by the condition, but it did not happen.

Anyone knows what i’m missing by any chance?


As well, if B is the solution,  Do i need to create a 3rd action to disable condition?

Thank you,

This is a really interesting question, I’m looking forward to hearing other people’s thoughts as well.

Some thoughts:

A) To speed up initial page load, uncheck “Load Model data on page load” in your model properties whenever possible. Then you can use theQuery Model action to load the data when you need it (e.g. as a tab action, or when you’re opening a drawer or popup). For more on improving performance see 5 Ways to Make Your Skuid Pages Lightning Fast and the Skuid Page Performance Guide.

B) Make sure after your Activate & Set value of model condition action, you have a Query Model action, this is the action that actually refreshes the model data. Use the query type that best fits your use case - you can either completely requery the model (this refreshes it wherever it’s found), or “get more” which will just add more records to the ones already in the model (use this one, for example, when opening table drawers, to keep the records in other drawers from disappearing).

Considerations for Reusing Models

When reusing models, be careful to keep in mind other places it’s being used and how it’s being used. For example, you can use the same model (for example, a Task model) to create a new task in one popup, and to show task details in another. But you have to remember that users may be coming to each of these actions from the other, and make sure the model gets reset appropriately (the Remove all rows from model and **Deactivate model condition ** actions are helpful here).

Example: if you want to see all bank statements in one tab, and this month’s bank statements in another tab, you can use the same model, but make sure that when the “all statements” tab is selected it deactivates the “this month” condition on the model and then completely re-queries the model.

Ooh, also check out this topic that I just found “How Many Models is too Many?” for helpful tips from product engineer extraordinaire Zach McElrath.

Ty, I did read that one, and that’s what had me worried for solution A lol

As most cloned models would pull same data over and over for different set of conditions…and prob slow down loading time

Thx

Dave, I haven’t tried the tab actions, but I think they’re prefect for your use case. On click of your tab (or button, if you want to use popups) you need to:

  1. Disable the other conditions from other tabs
  2. Activate or Activate & Set the condition(s) for the current tab.
  3. Query the model
  4. (and if you’re using popups, show popup)
That first part is going to be the trick… since you’re reusing the model, you have to make sure you have some way to deactivate the conditions that you’re not using. Since there isn’t a canned action for “when the popup closes” or “when you exit the tab” (unless you’re into javascript), deactivating the others before entering the new tab seems like the way to go.