https://www.growthbook.io/ logo
#ask-questions
Title
# ask-questions
m

modern-waiter-38896

12/12/2023, 7:49 PM
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

rhythmic-agent-34208

12/13/2023, 6:32 PM
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

modern-waiter-38896

12/14/2023, 5:16 AM
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

rhythmic-agent-34208

12/14/2023, 3:44 PM
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

modern-waiter-38896

12/14/2023, 7:06 PM
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

rhythmic-agent-34208

12/19/2023, 11:54 PM
Thank you, Jon, I created a GitHub issue for your suggestion here: https://github.com/growthbook/growthbook/issues/1972
4 Views