Struggling to create conditionals based on column in related table

I have a “User” table which has a field “subscription_status” which can be active, canceled, or blank. It also has a field “companies” which is a list of companies this user may belong to. This table, “Company”, also has a column for “subscription_status”.

Essentially, individual users can subscribe, or belong to a company that has subscribed. Either way, I want to count them as subscribed, but don’t want to brute force it by writing to a single column in the User table, since if a user belongs to multiple companies, any company being active should enable them to still use the service.

This conditional logic is not working, and I’ve tried countless variants of filtering the companies list based on subscription status = active and then doing a count >= 1, converting it to text and looking for “active”, etc. Any pointers, here?

Screen Shot 2021-01-28 at 12.18.13 PM

Hi there, @ffumarola… if I understand your post correctly, I was able to achieve the desired result by using an option set to define the subscription statuses and then tying the subscription status fields in the User and Company data types to the option set.

With that setup in place, this condition seems to do the trick…

So, it’s not all that different from what you did, but it does seem to work, and I hope it helps.


1 Like

@mikeloc This is awesome and did the trick! I hadn’t used option sets before, so a probably stupid question follows…

It did introduce one second order effect. I had been updating those fields using a “text” return from another plugin, as this example shows with “tiers” but is also true of the status you helped me with.

After introducing option sets, I’m no longer able to set the value because it’s a text field. Is this something that can be worked around, do you know?

What used to work but now has an error
Screen Shot 2021-01-28 at 1.38.05 PM Screen Shot 2021-01-28 at 1.38.21 PM

What I would need to do to make it work now revolves around doing one rule per option type.

Screen Shot 2021-01-28 at 1.39.24 PM

Happy to hear it worked for you, @ffumarola!

Hmm… I’d have to mess around with it, but instead of setting the value of the subscription tier to the text returned from the plugin, you might be able to set it to the option in the option set (via a search or Get an option) where the option’s display (which is text) equals the text returned from the plugin. I’m not sure if that makes any sense, but it seems like it could be a thing… in my head, at least. :slight_smile:

1 Like

Nailed it! Thanks again Mike :slight_smile:

1 Like

This topic was automatically closed after 70 days. New replies are no longer allowed.