Skip to main content

I have a a need to render some different layouts depending on the number of child records on the parent object. e.g. if the parent has only 1 child, the page is shown as ‘one’, where we mash up the two records into a single view. Between 2 and 4 we nest the children below, and more than 4, we provide a list.

How do I create the render condition that queries the number of records in a model?

Option 1: create a Roll-up Summary field on your parent model called “# of Children”, that just does a COUNT on the number of children. Then you could base your Render Conditions on the “# of Children” field on the parent Model.

Option 2: use JavaScript to listen for row creation / deletion events on the parent Model and then apply your own custom logic to decide which components to render / unrender. We can provide a code snippet for this if Option 1 won’t work, but I’d recommend Option 1, as it’s the path of least resistance.


Thanks Zach! Will try for option 1 for now.


I’ve the same requirement but I’ve got just one table where the lookup is to itself. So Roll-up summary. Could I have that code snippet?


And I need to show a message when the number of child records is less than what is expected, which is based on a value on the parent record, and I can’t use a roll-up summary because this is to manage/count daily attendance records.


Note.  As of the Superbank release it is now possible to specify rendering conditions based on number of rows in a model.  If rows = 0 show component A,  If rows=1 show component B, if rows = 2 show component C etc.