Forum Academy Marketplace Showcase Pricing Features

Exclude RG item if sub-item contains X

I’m having some trouble with setting up the logic for a Repeating Group.

Library –> Collection –> Book
The user is first presented with a RG of libraries, then Collections, and finally books in the chosen Librar/Collection. So far so good.

Now let’s say the user has a setting: Hide books with profanity (yes/no). The boolean Includes profanity is applied on the Books level.

The logic
When the user picks a Library, I would like the RG with Collections to exclude Collections where all books include profanity. The search today looks like this:
Do a search for Collections
Library = [chosen library]

I’ve tried Filtering and Advanced, but have gotten nowhere so far. How can I filter the Repeating Group, so that it leaves out categories where all books have “yes” on Includes profanity?

Why don’t you just use a constraint of false on the profanity bool?

I would, but the problem is that the boolean is in the books data type, not the collections data type. So it’s basically asking: if all the book items in this collection have profanity=yes, filter out the collection.

I’m sure it’s a noobish question, but I’m having problem accessing the boolean “one level down”, if that makes sense.

If you want to PM me a link to your app (editor), I’ll take a look.

I really appreciate that @csblack , but as we’re under an NDA with a client, unfortunately I can’t open it to anyone outside the company :worried:

My hands are bit tied, but thank you :slight_smile:

Is there any way I can describe it better so maybe we can solve it here?

No worries. I don’t exactly understand how your app is structure, so I can’t describe a solution. Usually the result of a search needs to be the thing you’re trying to filter. If you want to search for a book, and filter it based on a given yes/no field, you’d want the search to be of type book.

Alternatively, you could recreate the issue in the public forum app.

[Edit - my previous solution was doing the opposite of what you’re asking for… I think this should get it…]

How about…

Do a search for Collections: filtered

Search has the Library constraint
Filter constraint is Advanced: This collection’s list of books profanity is “yes” :count is not This collection’s list of books :count.

This assumes that you have a Books list field under Collections. The filter looks for Collections whose number of books with profanity <> its total number of books, meaning all books don’t contain profanity.

Try that? I hope it works…


Search for Collections :filtered

The filter above is as follows if Books is a list on Collection:
Filter 1 : This Collection’s Books :filtered {[This book’s profanity == yes] count == 0}
The filter above is as follows if Books is not a list on Collection:
Filter 2 : {Search for Book’s [Collection == This Collection && Book’s profanity == no]} count is not 0,
which returns a list of Collections that may have profanity, then perform a “remove set” of the set of Collections that do contain profanity (just change the filter to profanity==yes).

There’s probably a more optimal solution, but it’s getting late.

1 Like

Hey guys, we have been struggling a little with this lately and i read some forum posts about other people having issues with the contains argument, it`s very weird because yesterday the contains logic worked but now it doesnt. We are currently trying to filter away data in a repeatinggroup using constraints on the datasource, based on any of the tags in each item NOT being in the global filter-list.

In my screenshot I have some debugging fields visible, you can see the top one being the global filter tags and the bottom one being the current item tags. In some weird way it does not match even though it is in the list.

The datasource constraints are currently: this-item-filter-tags doesn`t contain current page items global-filter-tags

Debug data from view:

Element inspection in bubble: (treated as single item not multiple, or just how its linked from element inspection?)

1 Like

I managed to get my previous problem fixed using the “intersect” operation comparing the two lists, then if count is more than or equal to 1 it would be formatted as text and matching it to be a number

Repeatinggroup X’s List of Items:first item’s tags intersect with Current page thing’s globalfilters:count > 0: formatted as text (if yes=1 if no=0) is not “1”

If anyone else sees a better approach please let me know. I think we should be able to just check if a tag is present in a list but obviously it doesnt work properly according to my expectations.


This really helped! Thanks.

Brilliant workaround!

Sorry guys for the late reply, I appreciate very much the input you’ve provided. In the end, I decided to create a “Collection’s Books” data type with the books listed, even if it takes a bit extra work to maintain. It seemed to make this easier and with less strain on the database.