Hide Element from List of Text data type

Hi Everyone, I’m having trouble hiding elements based on a List of Text data type, please can anyone offer a solution to achieve this?

To summarise I have an Add User Account page, there’s a multi dropdown box which you can chose options from, lets just say colours for sakes of description, Red, blue, Yellow (Used the ‘Multiselect Dropdown’ plugin to do this). The colours are then stored in the User Data table and the Data Type for this is ‘List of Texts’.

This works fine, if I view the table in the App Data tab I can see the options I chose which are separated by a comma by bubble.

I now have elements on a page, say 3 groups, Red Group, blue Group & Yellow Group. I basically want to hide the elements based on the colours added to the users account, so If the User has colours Red & Blue in their account then the Yellow Group Element isn’t visible etc.

I’ve tried adding conditions to the Groups, When Current Users Colour’s contain etc but nothing seems to have any effect.

Please can anyone advise where I may be going wrong or am I missing something obvious?

Cheers

Why are you using texts for this? - An Option set would be much more logical and make things a lot simpler in the long run. If you’re not familiar with using option sets I’d recommend looking into it.

In any case, regardless of whether your colours are texts or an option set, using conditionals on your page elements should work - so you must be doing something wrong if it’s not.

Without more info it’s impossible to guess what that might be…

So feel free to share more details (screenshots, or even a read-only link to your editor) - then someone might be able to shed some light on where you’re going wrong.

I’m happy to use an Option Set for this if this makes things easier, could you possibly show me an example of how I’d use the option sets with the conditional rules please? I can add this to the multi dropdown box I’m just not sure how it relates to the conditions as I’m pretty new to this. I’ve attached a link to the app below for reference, this is editable as just a demo app which is separate from my main app I just use for testing stuff first.

Cheers

First of all, even though you ‘colours’ field is set up as a list (of texts), you’re not storing the data as a list (i.e. you’ve got a single text entry as ‘Red,Yellow’, instead of having an entry for ‘Red’ and an entry for ‘Yellow’).

You could keep it that way (although it doesn’t make any sense to as you’re using a list field), and then split the items out into a list using the :split operator, but it’s more logical just to save the items as a list in the first place.

Also, your conditionals on the coloured group elements aren’t doing anything - you’re using conditional logic to set the groups to be visible, but they’re all visible anyway on page load, so they will always be visible no matter what.

I’ve gone ahead and made the required changes in your demo app so now it’s working as expected (according to the conditionals you’ve set up at least).

But I’d still highly recommend switching to using an option set instead of texts - its much easier to work with.

Ah yes, I forgot to set them as not visible again when I was testing between ‘doesn’t contain’ and ‘contain’ but thank you for your help with this.

What did you have to change in order to store the colour values as an actual list instead of a single entry? I can’t seem to replicate this as when I add a new user from the add_new_user page it automatically sets all values to a single line?

Many Thanks

I just did it directly in the database to demonstrate the point, but obviously you’d need to change whatever workflows you’re using to set the data in the first place…

In your case you need to use ‘Add List’ instead of Add for the colours field

Ah yes that is perfect. Thank you for your help with this

1 Like