Show unique element (number) in a repeating group

Hi! So this is what my app looks like. It is basically a repeating group displaying a list of documents encoded in the app. The app would eventually create new entries under the same document number but in this view I would like to show all the unique documents based on the document number. What constraints or data source should I add and adjust?

I’m not sure what you are really trying to do, but I feel like you have multiple documents that will share the same document number, and if that is correct, the only reason that I could think of to do that is because somehow these documents are connected to each other; sort of like they belong to the same folder or all belong to the same court case or something like that.

If my thought is correct, you would just add a constraint to your search which would be the document number of all the documents you want to view.

My confusion though is when you mention all the unique documents based on the document number, which would imply you expect to have multiple of the same document with the same number, as if there may be the same file uploaded many times.

If that is true, after your search add the :unique elements operator…but that not work on files that are the same but have different names as the database would probably not recognize it as being the same if it is seen as another data entry.

It’s because I’m trying to log every changes/modification to a document. A document tracking/management system. To do that, I need to create new entry for the changes in that same document, right?

For example:
Document Number Status Time
12345678 Forwarded 1:00 p.m.
12345678 Received 2:00 p.m.

So there will be a duplication of document number but in the view in the screenshot above, I want to only show the unique last item of all the documents.

As @boston85719 suggested use the constraint “document number”in your search. If you are setting your page to be that document then you can use “document number = page name document number

I managed to show all the distinct documents but how can I include one instance of a duplicate since :unique elements removes all the duplicates.

I thought you wanted to show unique elements

I guess this meant you want to see all the documents that share the document number…in this case just remove the unique elements operator

I thought you wanted to show unique elements

Yeah I did. Sorry, what I really meant was to display all the unique documents in a repeating group but retain the last entry of a duplicate entry . This is what the output should look like.

Number | Time | Subject
12345 | 1:00 p.m. | ABCDE < should be retained since it's last entry
12345 | 12:58 p.m. | ABCDE < should be removed
88888 | 11:00 a.m. | EEEEE < shown since its unique
55555 | 11:00 a.m. | FFFFF < shown since its unique

In that case put a constraint onto the search that looks at the modified date of the document and create a dynamic expression to show the document whose modified date is most recent

Okay but this constraint removes all double items from the list.
I tried the constraints below but returns empty.

Sorry I’m lost.

remove the unique elements operator

sir can you give me a sample constraint and then the dynamic expression in achieving this? I still can’t wrap my head around to display the last instance of a duplicate entry.

To be honest, I really don’t fully understand exactly what you are trying to achieve with the duplicate entries, but my thought as a constraint or dynamic expression would be to use a sort and then limit the number of items to the items until #1.

This way, you get the full set of all the duplicate documents, then sort by modified date so the most recently modified document is at the top of the list and then display only that first list item (the most recently modified document)

I do private coaching sessions if you are interested in setting something up. You can PM me for details.

1 Like

To be honest, I really don’t fully understand exactly what you are trying to achieve with the duplicate entries,

What I’m trying to do is like this, a message thread view wherein the list contains Unique Contacts (in my case Documents) . As you can see, the latest message sent/received is shown as preview below the contact. Tapping the thread opens up the conversation (in my case that Document’s log). Is my process in implementing this cumbersome?

Hi there, @christianbernliboon… I saw the other thread you posted about this one (Display all distinct items + last entry/instance of a duplicate entry in repeating group), and then I noticed this thread popping up. If I understand your posts correctly, here is one way to do it…

Do a search for documents with no constraints…

Then, use the :group by… option and group the search by document number…

Finally, for the fields in the repeating group, do a search to display the current cell’s document’s last item’s information…

Is that the “best” way to do it? Probably not (and maybe boston or cmarchan can check it out and poke holes in it or suggest something else), but it produces the desired result, again, if I understand your posts correctly.

Hope this helps.


If all you want to do is have the most recently modified document be at the top of the list, then simply sort by modified date and set descending to no, so that all documents will be displayed in the order of the modification date with most recent first.

If you want to not have duplicates shown I believe what Mike provided is a detailed example that should do the trick

Thank you! I’m getting close to my desired output now. The only problem left is that the documents are not sorted by the latest entry. It seems like it follows the grouping by document number and sorts in ascending order.

Try changing the type of content of the repeating group to number, and then set up the data source like this…

That should get them sorting in the desired order.


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