Hello, I'm trying to make a saved group on a boole...
# ask-questions
m
Hello, I'm trying to make a saved group on a boolean attribute and it's not working. In my case I have a boolean attribute called
is_staff
and I would like to make a saved group that targets this attribute. The resulting query in the feature definition looks like:
Copy code
{
          "condition": {
            "is_staff": {
              "$in": [
                "true"
              ]
            }
          },
          "force": true
        },
This doesn't work when evaluated on the client. Thanks.
r
Hi there, Jon, thanks for reaching out. Saved Groups in GrowthBook are typically created based on a list of attribute values or determined at runtime. They are generally used with attributes that have a list of possible values, such as user IDs or device IDs, and are referenced in feature targeting rules. However, for targeting users based on boolean attributes, you would typically use the attribute directly in the targeting rules without the need to create a Saved Group. For example, if you have a boolean attribute ​`is­_staff`​, you can set up a targeting rule in the feature flag configuration to target users where ​`is­_staff`​ is ​`true`​ or ​`false`​. If you want to create a group-like structure based on a boolean attribute, you might consider using Runtime Saved Groups, where the group membership is determined in your application at runtime. You would then pass a special attribute named ​`$groups`​ that contains an array of group identifiers, which could be based on your boolean attribute (​*source*​).
m
Got it. Yeah for my case a saved group based on the boolean value would have been a little clearer to our team than just using the targeting attribute. Thanks for your response.
r
Hi Jon, for sure, I can see how that would have been clearer. Let us know if there's anything else we can help with. 🙂
m
If string values are only allowed in groups, I would suggest blocking the ability to add non-string values as an attribute when creating groups.
r
Thank you, Jon, I created a GitHub issue for your suggestion here: https://github.com/growthbook/growthbook/issues/1972