I am trying to use SUBSTITUTE on a string that the user pastes into TextInput1. The challenge is the "old text" parameter needs to check the below MAPPING_TABLE for any value in OLD_NAMES that matches any pattern in the pasted string and then returns the corresponding value in NEW_NAMES for the "new name" parameter. Ultimately I am trying to automatically revise their pasted string with a new string with the substituted values from the table. I am using Dataverse.
I tried running this code as the Text property in Label1 but I am getting an error "Expected Text value".
ForAll(
MAPPING_TABLE,
Substitute(TextInput1.Text, ThisRecord.OLD_NAMES, ThisRecord.NEW_NAMES)
)
MAPPING_TABLE
| OLD_NAMES | NEW_NAMES |
| Nantucket | Boston |
| man | woman |
| from | who lived in |
Example:
user pastes in TextInput1: "There once was a man from Nantucket"
expected output in Label1: "There once was a woman who lived in Boston"
Case sensitivity shouldn't matter.
Your help is appreciated.