Specify the number of times a particular constraint occurs in a repeating group

Hi everyone,
So I came across this tricky search that I need to perform and I’m wondering if anyone has any bright ideas of how to solve it.

I have a datatype that has a list of items called “courses” and each course is set to either be beginner or advanced. I have a repeating group that shows three random courses like this:
image

I want to be able to specify the number of beginner and advanced courses in the list of three. So, for example, I want the repeating group to show 2 beginner courses and 1 advanced course. I’m guessing this requires an advanced search but am stuck on what to specify for the advanced search.

I know that I could just fake this behaviour by setting up a repeating group with two elements in it called “RepeatingGroup Courses: beginner” and another repeating group with only one element in it called “RepeatingGroup Courses: advanced” but this doesn’t give me the dynamic capabilities that good bubbling should have (let’s say I want to change from 2 and 1 to 1 and 2 at some point in the future. This would be much more involved with the “fake” approach)

Anyone got anything for me?
Thanks so much
Paul

Two lists, merged.

1 Like

That’ll do it. Man I hate it when I should’ve come up with the obvious answer myself.
Thanks for your help…I feel dumb

1 Like

This is one of those Bubble nomenclature things. What is :merged? It’s really CONCATENATE (take one list and push/splice another to its end). The nomenclature gets in the way of problem solving. It’s like the conundrum of boolean negation in Bubble (that is to say, “WTF is some_Boolean is “no”… … … OH!).

I know what you mean. I haven’t used merge and intersect too much but when I do I always have to study the docs on each one to remind myself. I think you’ve correctly articulated why I need to.

TF is concatenate all I know is :merged with (I’m dead serious)

2 Likes

To “concatenate” is to take one array and append it to another.

I have an array [a,b,c] and an array [d,e,f].

And now I concatenate them:

[a,b,c,d,e,f]

1 Like