Hello,
I am having trouble trying to find and replace a value in a record. I have tried many combinations of Replace and Substitute, but to no avail. I can't seem to get it quite right.
The record is called myChosenLlist. myChosenList.items is a table nested within that record.
The myChosenList.items table looks like "Oregon, Washington, California, a". Note that the last value is just "a".
I want to change "a" to "Arizona", so the end result will be "Oregon, Washington, California, Arizona"
I want to set it to the renamedItemsList variable.
myChosenListItem is a variable with the value "Arizona" in this example.
The logic that I am using is:
Set(renamedItemsList,Substitute(Left(Concat(myChosenList.items,Value&", "),Len(Concat(myChosenList.items,Value&", "))-2),myChosenListItem,Trim(NewNameTextInput.Text)))
or, formatted
Set(
renamedItemsList,
Substitute(
Left(
Concat(
myChosenList.items,
Value & ", "
),
Len(
Concat(
myChosenList.items,
Value & ", "
)
) - 2
),
myChosenListItem,
Trim(NewNameTextInput.Text)
)
);
However, the result is now "Oregon, WArizonashington, CArizonaliforniArizona, Arizona". Note that the 1 a in "Washington" and the 2 a's in "California" are also substituted, which I do not want.
Am I approaching this incorrectly? Converting the table to string first, then substituting? Is there a cleaner way that works?
Thanks a lot in advance!