"No Row in Source Model" for Conditions on Child Relationship Fields in a Model

  • 1
  • Question
  • Updated 4 years ago
  • (Edited)
What is the intended outcome when setting "No Row In Source Model" to "Abort this Model's Query" on a child relationship field's condition in a model? 


My specific situation: I have a condition set on a child relationship where the source model contains only a single row that has not yet been saved...so, when I had "No Row In Source Model" set to "Deactivate this Condition," the condition would be deactivated and all existing child records would be shown.
So, I had assumed that setting this to "Abort this Model's Query" might just abort the query for the child relationship...but in practice, it aborts the entire model's query. (which, given that a child relationship here isn't actually a model, the wording does makes sense...).
My hope had been that it would abort the child relationship query & then after the source model's record was saved I could requery to get related child records.

Maybe there's another way to go about this, and I am certainly open to suggestions! But, I'll settle with getting an understanding of how this property on a child relationship condition will affect the model.

Thanks!
Photo of Pat Hicks

Pat Hicks

  • 898 Points 500 badge 2x thumb
  • Curious

Posted 4 years ago

  • 1
Photo of Greg Jarrett

Greg Jarrett

  • 3,496 Points 3k badge 2x thumb
Hi Pat,

Have you tried setting an action on the parent model (when it is saved) to requery the child model? 



You could use the 'Query Behaviour' to add rows rather than replace all rows in the model.



In response to your actual question, my understanding of the 'abort this model's query' option is that if the condition doesn't exist, then you don't want to query for any data or present any data to the user (otherwise it could return hundreds or thousands unrelated rows which don't match your condition)

Does that help? 
Photo of Pat Hicks

Pat Hicks

  • 898 Points 500 badge 2x thumb
Hey Greg -- 

Thanks for the response. For "Abort this model's query" I do follow that if that option is selected, then no data should be queried. 

What's strange to me is that aborting the child relationship's query aborts the query for the entire model ...
It seems like that shouldn't be aborting the model, just the query on this child relationship.
Basically, I'd expect to see the model data, but nothing queried for this child relationship.

Thoughts on this? Do you think I'm trying to perform some sort of unnatural act?

I'll admit, I may be putting this model in an awkward situation by referencing another model that only has one unsaved record on page load...

Thanks!
(Edited)
Photo of Greg Jarrett

Greg Jarrett

  • 3,496 Points 3k badge 2x thumb
I'm definitely not qualified to give an official answer on it, but I think it might be an unnatural act as you say. It looks like you've got the child relationship contained 'within' the model, so yes, it aborts the query for the whole model.

I hope I can be proven wrong however and there is a solution here for you somewhere.
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
I thought I had answered this yesterday.  But no...

Pat's diagnosis is correct.  When you abort the child relationship subquery if no values are found it aborts the whole model query,  rather than just the subquery part of it.  Right now there is not a declarative way to solve this problem.  And no - I don't believe this is attempting an unnatural act... 

I'll post this as a reccomended change in our roadmap. 
Photo of Pat Hicks

Pat Hicks

  • 898 Points 500 badge 2x thumb
Thanks Rob.
So ... is there any way to update a Child Relationship's conditions via Javascript?
Photo of Pat Hicks

Pat Hicks

  • 898 Points 500 badge 2x thumb
Looks like I was able to write a renderer to get me where I needed to go. 
Filtered a related model (filled with the Child records) to display a value in a column on the parent object's table editor.

Pretty much what was happening with the Child relationship, just set up so it could handle the fact that only 1 of the 3 involved models were saved on page load... (that is, to avoid the "ignore condition" versus "abort model's query" situation).