Essentially, a user provides a string into a textInput box, and after clicking a button, checks if any of the inputted values exists in a specified table. If the values does exist, it should append a value from the table to a new string. The result is then displayed to the users.
The string would look like this: "Amy, Josh, John, Adam"
The table would look like this, and let's name it Sample_Data (Dataverse table):
| Name 1 | Name 2 |
| Arnold | Smith |
| Josh | Man |
| Josh | Cruise |
| Amy | Woman |
| Charles | Name |
So the resulted string would look like this:
"Josh Man
Josh Cruise
Amy Woman"
I've started the below code, but maybe it's because I'm thinking about this like how I would approach this in things like C++ or Java, but I'm struggling to get it to translate in the onclick function in the button:
//userInput is the name of text box the user types the string in
Set(parseString, userInput.Text);
Set(parseTable, Split(parseString, ", "));
Set(resultString, "");
// Loop through each entry in the split string and append matching entries to the result table
ForAll(
parseTable,
If(
!IsBlank(Filter(Sample_Data, 'Name 1' = Value)),
ForAll(
Filter(Sample_Data, 'Name 1' = Value),
Concat(resultString, Value.'Name 1', " ", Value.'Name 2', "\n" )
))
);
The reason for the double ForAll is because, in case the If fails and the value isBlank, I may still add the value to the string, but concat something like " - doesn't exist" to the value of the name. Any help would be appreciated, I'm sure I'm just thinking about this more like a traditional programmer and not like a PowerApps one. I'm still relatively new to PowerApps, so I'm sorry if I'm missing something simple.