Hi All -newbie here 
I’m currently trying to figure out what I’m doing wrong with Constraints when searching for Things.
In my app users are working on what is essentially a comments Board and I have a series of labels that users are able to add to each comment card they create. However, there’s also the option for users to create new labels, which should be available to everyone else in their Project.
The initial set of out-of-the-box labels are available to all users in all Projects and as such have an attribute called ProjectOrgKey which is set to ‘Default’.
When new Labels are created I set the the ProjectOrgKey to a distinct value based on the project the user is working on.
As such, the list of labels I want to present to the users should be a combination of the ‘Default’ labels plus any custom ones that match the project they are working on. They shouldn’t see any custom labels created for other projects.
My repeating group is set to search for labels with the constraint ProjectOrgKey is in the relevant DB field for the Project’s Board (which is a list).
The issue I have is that the Default labels return fine, but the custom ones never show up.
Am I understanding/using the right kind of constraint? I’ve tried ‘contains’ too, but that returns no labels at all.
The data looks right when I check it in the DB - i.e., the Board entity has a list field which correctly contains which Project Org Keys to look up for Labels, and the newly created Custom labels have a matching ProjectOrgKey.
Any help greatly appreciated 
Hi there, @mckenzie.aly… it would be great if you could share some screenshots of your set up because in theory, what you have described should work. Without more to go on, I wonder if privacy rules could be getting in the way, but that’s a total shot in the dark without being able to see anything under the hood. If you don’t want to go back and forth here, you could share a link (privately) to your editor, and I’m sure we can figure out what’s going on.
Best…
Mike
Hi
Thanks for the response.
Here’s one type of my Label entities, illustrating that their ProjectOrgKey will either be set to Default or to a specific value (which is a concat of two separate values).

and here’s a shot from my Board entities - the ‘Board Labels’ field is a list, which will usually contain ‘Default’ as well as the specific ProjectOrgKey that relates to that Board.

And here’s my constraint Ccnfig for the repeating group:
Let me know if that’s enough info to see what’s going on 
I set up an example on my end that looks very similar to yours, and it works fine. Still willing to take a look under the hood if you want, but here are some things that come to mind… what is the conditional on the repeating group? Is the current page’s board populating correctly? Are there any privacy rules in place that could be getting in the way? Have you checked the debugger to see if you can get any hints there?
1 Like
I have a feeling @mikeloc is on the ball, but one option you could consider is using Option Sets. @AirDev 's bootcamp Week 2 has an example of how to use option sets to create tags (labels in your case) that might do what you are looking for, but this would mean a little bit or re-design and if Mike can give you a solid solution then see what you can do with it. Thought I’d throw a potential solution into the ring though.
Otherwise, as Mike said, Privacy Rules are a common snake in the grass but difficult to confirm without more info.
2 Likes
I am always quick to recommend option sets, but if users need to be able to create their own labels on the fly, a custom data type is the way to go.
This makes sense, you’re right, thanks for the note!
1 Like
Thanks for the responses.
I think I’ve gotten to the bottom of it, but I’m still not 100% sure how to resolve.
The issue appears to be that when I set the ProjectOrgKey for the new custom label (using the Board’s Project Org Key to populate the value) the application is appending a trailing space to the value - obviously, this means they don’t match when it evaluates the constraint. If I go into the database and delete the trailing space from the end of the label’s ProjectOrgKey value, the label shows up in the UI.
Is there a way to avoid this behavior when setting one value based on another? Kind of like a ‘Trim’ function? Seems very odd that a trailing space would be added TBF, so perhaps there’s something odd that I’ve done when setting the value.
Yup, Bubble has a :trimmed operator.
Hmmm. Just gave that a try but no joy…
I think the trouble with that is that (if I’m reading this right) then the trim is being applied to the wrong entity. It’s the Stop Label’s ProjectOrgKey that has the trailing space, not the Board’s

I had a look but I can;t seem to see a way of implementing the trim at the point of setting the label’s ProjectOrgKey attribute (which would feel like a nicer solution - I’m certain this will catch me out again if there are more scenarios where a traioling space is added
) Any tips?
Appreciate the help so far!
Yeah, that sounds like exactly what you need to do… not sure why you can’t do it, though. Can you tell why the space is being added in the first place?
It’s highly likely to be user error 
When I try to add it at the point of creation, it doesn’t seem to recognise it as an operator and just appends the test ‘:trimmed’

I’ve gotten things working by adding a new step which immediately make a change to the Thing, setting the value to the trimmed version.

Doesn’t seem very elegant, but it works 
1 Like
Try copying the expression in the second screenshot into the first screenshot. 
2 Likes