Skip to main content
Nintex Community Menu Bar
Question

Count of child records for the parent record in context

  • July 12, 2024
  • 3 replies
  • 31 views
  • Translate

Forum|alt.badge.img+3

Is there any way to get the count of the child records for the parent record in context? For example, I need to know the number of the Quote child records for the current Opportunity in context. Any way to achieve this declaratively?

Did this topic help you find an answer to your question?

3 replies

annajosephine
Nintex Employee
Forum|alt.badge.img+18
  • Nintex Employee
  • 867 replies
  • July 12, 2024

Yep, you can definitely do this declaratively! Just make sure you include the child relationship in the model and then you can use

{{Quote.records.length}} (or Quote__r if it’s a custom object) in a text component or template field.

Check out the solo adventure at the end of the Skuid Skool course Configure Model Fields for an example

Also there’s a merge syntax cheat sheet in this course: Magical world of Merge Syntax

See also
https://docs.skuid.com/v16.0.7/v2/en/skuid/merge-syntax/#merge-variables

Translate

Forum|alt.badge.img+3
  • Author
  • 23 replies
  • July 12, 2024

Hi @Anna_Wiersema ,

Thank you so much for your response. Learnt something new today 🙂

However, I am also using some models based on REST data source and have established relationship via a text field. You can think of it as two models where one of them is a parent model and the another one is a child model. Each record in the child model has a ParentId field (text field) which is populated with the Id of the related parent, this Id is the unique Id which Skuid generates. For each row in the parent model, I want the number of child rows.

Any suggestions to implement this?

Translate

Forum|alt.badge.img+17
  • Nintex Employee
  • 3763 replies
  • July 12, 2024

I think the most reliable way to produce this output would be to build it within your endpoint, so that the parent endpoint includes the count of child records (an aggregate).

But knowing this is not always possible, I think your best bet will be a snippet that iterates through the rows of the child model, and for each row, uses the parent ID to determine a value to update (+1) or creates a new value. Once you have iterated through the rows - you can push these aggregate counts into a UI only field on the parent model.

Translate

Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie Settings