How to search checkbox, dropdown, and multiselect fields in a record for specific input

How to search checkbox, dropdown, and multiselect fields in a record for specific input

Have you been trying to search a checkbox, dropdown, or multiselect of a record to see if it matches a specific word that was inputed into a stateless form?

Here is how you do it.

for each Record in YourFormName
{
            if(Record.FieldName.toString().toLowerCase().contains(SearchCriteria.toLowerCase()))
            {
                  //do something when you find what your looking for.
            }
}

Record.FieldName is the field name in the form you want to access.

.toString() will change the checkbox, dropdown, or multiselect into a single string from a stringlist.
.toLowercase() makes sure everything in the string is lowercase.
.contains() searches the string for your criteria;
SearchCriteria is the key word you are looking for and for good measure make it also lowercase.

Instead of dealing with the list by searching it like a list I changed it to a single string because after its a single string you can do partial searches for parts of words. So you an have options like Business- web lead and Business- phone lead as options and get both of them as a result.

I set everything to lowercase because the contains() method is case sensitive so I just remove case entirely.

Hope someone finds it useful!