Does anyone know why “:count” doesn’t show up in the below? OS - Pipedream URLs is an option set. I am trying to return the number of options in this option set.
If I do a search for a data type, the :count parameter is there
Does bubble not allow you to return the number of options in an option set?
I know I could use :approximate count but the number of options in my option set is over 100 and the documentation says that approximate count is only good to +/- 2% and I need an exact number.
Hi there, @paul29… something isn’t right and we probably need more context because you can definitely use the :count operator to get a count of the number of options in an option set. I don’t know if this has anything to do with it, but what is the field type of the Count field? It probably couldn’t hurt to share more screenshots, too (maybe the setup of the option set and the Pipedream counts data type).
Yeah, something strange here… I don’t think I’ve ever seen :each item's count before (I certainly can’t find anyway to make that show up)
(I’m not sure it makes any sense - it might imply you could use it to count a list of lists - but that’s never been something you can do in Bubble as far as I’m aware)
You should definitely be able to use All Options: count to get the count of all the options.
Thanks for everyone’s help here.
Here are the option set attributes:
I have also played around with doing the same thing for other option sets and I get the count field as expected:
In fact, I cycled through all of my option sets (there are about 12 of them) and they all have the :count as expected but just not the Pipedream OS.
I’m sure I can solve this by deleting the option set and reentering it again but since there is no bulk upload for OS’s, I really don’t want to have to do this all over again
I think Adam is saying that explains the :each item's Count thing because you have an attribute on the set called Count. What I’m still not getting is why you can’t create an expression for All OS - Pipedream URLs:count, but maybe I am missing something obvious.
I did some testing, and I feel like I am going crazy. I have a couple of existing option sets that both have attributes with an attribute type of number. With both of those sets, I am able to get a count of the number of options in the set by using the :count operator. So, I created a new option set, and when I add an attribute with an attribute type of number to that set, I do not have the :count operator available. Again, I am either going crazy or it’s a bug.
Oh yah, I get that part about the :each item’s count.
I just tried creating a new test OS on my end too and I added the Count attribute (type “number”) and I still get the same issue (i.e. no :count). I then deleted the count attribute and everything works as expected.
It seems like there is a bug that if you have an attribute in the OS that is type “number” then you don’t get access to :count
That explains why you’re seeing each item’s count - which is not something you’d ever normally see in Bubble (as it doesn’t make sense - except for the fact that you have an attribute called Count on the Option Set)…
and it explains why you’re not seeing the actual regular Count property… in the sense that (presumably) your Count attribute is conflicting with the built in Bubble Count property of the list somehow…
Bubble is usually good at handling things like this - usually, giving things, fields, options, attributes etc the same names, whilst generally bad practice, doesn’t cause any conflicts (because the names you give things aren’t necessarily the names that Bubble uses for them behind the scenes).
But in this case, it looks to have confused Bubble - I can replicate the issue, just like @mikeloc did, so I’m guessing this is a general bug that affects all apps.
The same thing happens if you set any attribute with names of built in operators… such as ‘Approximate Count’, ‘Contains’, ‘Cached Aggregation’ and various other attributes.
It also happens in reverse… i.e. if you set an Option Set attribute called ‘Filtered’ it won’t appear in the dropdown (you’ll only see the standard :Filtered operator, NOT each item’s Filtered - so you can’t access that attribute.)
So, it’s definitely a bug… (an interesting one…) that seems to be to do with duplicate/conflicting property names.
A couple of simple workarounds though…
Delete your ‘Count’ attribute, and add another one - you can still call the new one Count… Bubble gives attributes unique names behind the scenes, so your new Count attribute won’t be the same as the old one as far as Bubble is concerned - so it won’t confuse it with the built in Count operator.
Or you can add an attribute with any name (other than those mentioned above) and then change it to Count. Again, Bubble gives unique (and unchanging) names to things behind the scenes, so even when you change the name of something its original name persists underneath. So again, this won’t get confused with the built in Count operator.
FYI, @adamhholmes… what I saw is that an attribute with any name that has an attribute type of number causes the issue… so, I don’t think it was related to the attribute being called Count (if that’s what you were saying, but I might have misunderstood).
it’s definitely the case for me that it’s the attribute’s name that causes the issue - a Number attribute of any other name works just fine… whereas an attribute with the name of certain other built in properties or operators also causes the same issue (regardless of type).
Specifically, the following names cause the issue:
Count
Contains (but, interestingly, not Doesn’t Contain, nor Contains List)
Cached Aggregation
Approximate Count
So, maybe there are multiple different (but related) bugs here affecting different apps in different ways…
I’ve never come across it before (but then I’ve never given an attribute the name of a built-in operator).