Deactivate condition on "none selected" from dropdown

  • 1
  • Question
  • Updated 3 years ago
  • Answered
I'm trying to work through a condition logic issue and having some trouble. I have model A which has a location field. I am trying to activate and set the value of model B with that location when it is selected from model A to only pull model B records at that location. Model B data is then used in a Ui-Only field Model lookup on Model C.

Currently I have a condition on model B set to == the location value from the first row of model A. This condition is activated and value updated on model A updates on the location field. 

All of this works as expected when I select a value.

Except for two things:

I would like when location is set to -None-, all of the records from model B are pulled in. 

I have not found a way to do this other than have the "Clear Location Filter" button that deactivates the condition on Model B, but I would love for it to be automatic and not rely on the user to manually reset it.

Should I do this with a JS snippet to run on model A update of location field to check if the field is null then activate/deactivate the conditions accordingly? Was trying to do it with the action framework but can go to JS if thats the only way. 

My second issue is related to a UI only formula field on model C that depends on the model lookup field being altered above. When I change my location, the model lookup field works great, but the simple formula field which is just doing subtraction changes to 0 on all records. Re-querying the model does not help. I thought I saw something on here about an issue related to ui-only formula fields based on other ui-only formula fields. Not sure if its related to that or if its an asynchronization issue. 
Photo of Craig Rosenbaum

Craig Rosenbaum

  • 4,776 Points 4k badge 2x thumb

Posted 3 years ago

  • 1
Photo of Anna Wiersema

Anna Wiersema

  • 10,890 Points 10k badge 2x thumb
Hey Craig, for curiosity's sake, on your Model B condition in the Value area, what option have you selected for "If no row in source Model then..."?  You can set this to "deactivate the condition" which will pull in all records from Model B... but maybe only in cases when Model A is empty, and not when there is a row in Model A but Location=None.

Hmmm... As far as I know I think it may have to be JS. 

And yes, I would guess that the second issue is because of the ui-only formula field issue, which has been resolved as of version 7.18 (if you don't have it, you can download it at skuidify.com/skuidreleases). I think Model Order is also important here: make sure that the models with dependent fields areafter the models with the fields they depend on. But it sounds like you've already done this, if your Models are in ABC order ;)
Photo of Craig Rosenbaum

Craig Rosenbaum

  • 4,776 Points 4k badge 2x thumb
Unfortunately Model A will always have a value, so I wasn't able to use that first approach. I was hoping for something like that but for null values on a condition. Add it to the idea board :)

Looks like I need to update, I'm on 7.16. Hopefully that will solve it.