Constraining list of things by unique field element

Hi,

I need some help with doing a more complex query within a repeating group.

In my database I have a Thing ‘Jobs’ that contains a field ‘Organisation’. A job can only have one organisation but there are multiple jobs with the same organisation.

I want to display a list of jobs with each organisation having one row within a repeating group of jobs. So I need to find a way of constraining the list of jobs by a unique organisation.

What’s the best way to write this query? I’m struggling because currently I can apply ‘Unique Elements’ filter to the Thing (i.e. Jobs) rather than a specific field within the thing.

Hey @messly

Maybe you’ve already tried this, but I’d recommend:

  1. Setting the data source of the RG to Organisations and data source to Do a Search for Organizations
  2. Have a dynamic text field in the first cell, which should look like Current cell's Organisation's Jobs's Name

Hope that helps
Ambroise

Need extra help?

Book a free 15 minutes call - happy to help if I can

Hi Ambrose,

Thanks for your help. Yes I did think about that approach. I was actually looking for a more efficient way of doing it as I have over 8000 organisations in my DB so didn’t want to run a search on them.

Jobs is actually linked to a ‘User’ thing so I’m actually loading Parent Groups User -> Jobs in the repeating group which is much faster, but having issues getting the unique organisations.

Hey @messly

‘Do a search for’ usually performs better at scale than ‘Parent Group’s User’s Jobs’. However if you’ve compared the performance and you want to keep your current setup, then I guess your User data type has a field Organisation, and you should be able to set the data source to Parent Group’s User’s Organisation?

I would also advise to use the external vertical RG so that items are loaded when user scrolls down, instead of loading them all on page load btw - but you seem experienced enough to have done that already :slight_smile:

Ambroise

Need extra help?

Book a free 15 minutes call - happy to help if I can

This topic was automatically closed after 70 days. New replies are no longer allowed.