I was wondering if there is a way to have a string stored in a database that contains "references" (I think the proper term is bindings?) to variables rendered after interpreting those references instead of as a string.
Assume the following:
I have a page with a server connect sc1 that returns the a value called radius
I have a variable call pi, that contains the value 3.14
I have a paragraph that looks like this:
Perimeter: {{sc1.data.radius * pi.value * 2}} cm
When the page is rendered, and ignoring any syntax error in my example and assuming that sc1 returns a radius of 10, the following will be shown:
Perimeter: 62.8 cm
Imagine that now I wanted to keep the text in 3 above in a database table, and that I have a server connect sc2 that retrieves the value of that string.
If I invoke sc2 and put the results on the page (something like sc2.data.stringtoshow, the page now shows the string as I saved it, i.e., without interpreting the values of the variables. It would look like
Perimeter: {{sc1.data.radius * pi.value * 2}} cm
I sort of understand why this happens but I'd like to know if there is a way of storing in a database table a string that contains references to variables, which can be later interpreted and rendered as the results of the reference and not as a string.
For a variety of reasons, the main one being my ignorance of how to do it , I don’t want to write custom code.
My use case for this feature is for sections of a page that have mostly static text BUT that also have some dynamically generated strings in the middle of it. In my particular case, this is used in an attestation page where the wording (static and dynamic) may need to be changed often until all the sponsors agree on the text. As it stands, we need a Production deployment every time instead of changing text in a database.
The latter approach, however, only works well if static text is used, thus my question.
I will repost this as a feature request: To add native option to Wappler (let’s call it “Inner Parsed” for now) to allow parse dynamic content like one retrieved by a server action, parsed before rendering it in the browser. This “Inner Parsed” option will be show right beside the “Inner HTML” and “Inner Text” options that appear under Dynamic Attributes > Display.
This is something like INDIRECT() in msft excel. Maybe @patrick would consider such a function for Wappler!
I can see a use case for this when we need to allow end users to put in their custom formulas or something in runtime!