I have a collection containing some text values:
And now I want to loop into the collection, and compare its text values with a text box value. If they match, do A thing, otherwise do B thing.
How can I compare these string values ?
Solved! Go to Solution.
oh sorry to ask one more point @yashag2255
As there are multiple entries in the collection, I want to have the actions for every entry in the collection. Is this correct:
ForAll( myCollection, If(Textbox1.Text in myCollection.Value, "Do A", "Do B") );
Does it make sense ?
Hi @gavinleung ,
You're on the right track and what you've got should probably work - but you can just refer to the myCollection column directly while you're in the scope of the ForAll - so;
ForAll( myCollection, If(Textbox1.Text in Value, "Do A", "Do B") );
Also, "in" will match for strings and substrings case insensitive, so depending on your use case you may want to use a different operator.
eg: Matching "Ian" against "Bian" would still match. In this case, you may want to change your operator from "in" to "=" to be more specific.
Check out new user group experience and if you are a leader please create your group
Did you miss the call?? Check out the Power Apps Community Call here!
See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.
ISV Studio is the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.