Substitute text elements with field values like template variables

Hi all,
I would like to replace text with variables from the current row like the functionality in template variables (without using a lot of substitutes).

e.g.:
Text in a field: “your order <<[Order Number]>>…” and the variable <<[Order Number]>> should be replaced with the value from the column [Order Number].

This should work with any column field and not only with predefined substitute expressions.

Hope there is a solution?

Thank you very much, Joachim

0 8 533
8 REPLIES 8

Aurelien
Google Developer Expert
Google Developer Expert

Hi @Joachim_Mund

What about CONCATENATE ?
CONCATENATE(“Your order ",[Order Number]," is available here")
or, alternatively:
“Your order " & [Order Number] & " is available here")

For reference:

Thank you,
I have template texts in a separate table which someone can choose and they are copied in another field.
These text strings should be able to contain variables which will be filled during the process of copiy.
Thus concatenate is not usable in this context.

OK, so you may want to display some sort of enum to the user, and set a value that will be saved depending on this enum value.

For example, let’s say you have an enum field [myEnumChoice] having “choice1”, “choice2”, choice3".
Then, your expression in the [outputResult] column could be:

SWITCH([myEnumChoice],
 "choice1", "yourTextWithConcatenationExpression_1",
 "choice2", "yourTextWithConcatenationExpression_2",
 "choice3", "yourTextWithConcatenationExpression_3",
 "yourTextWithConcatenationExpression_Default"
)

For reference:

If that still does not help you, you may want to provide further context

could not be read from a table with template text values.
Although the example can only process one choice in a sentence (text template)

Ok, I think I understand. You want the actual text stored in the table to contain the references to the column names so that when that column value is applied - the referenced column name is replaced with the value from the column.

AppSheet does not support this as of now.

Yes @WillowMobileSystems that is exact what I want.
An “INDIRECT” function could solve this but is not available.
The only solution I actually have is a cascaded SUBSTITUTE if I have a list of possible fields, which is not dynamic. If someone add e.g. [field3] I have to add a new substitute function.
SUBSTITUTE(
SUBSTITUTE(
SUBSTITUTE([field], “{field1}”, [field1]),
“{field2}”, [field2]),
“{field3}”, [field3])
)
etc…

SUBSTITUTE is ok, but as you sad you need to add new one for every new value. SUBSTITUTE also breaks formatting, example new rows. 

Top Labels in this Space