Enter the content of another field inside a rich text field
Hello again. I'm just ending the development of a custom application that needs to print and export some rich text fields with lots of text. What I need is some kind of "data merge" inside a rich text field, to enter some dynamic data. For example, in a long rich text field for a contract, I want to show the client name, age and address.
Is there some "hidden" HTML code to insert a placeholder and replace it with the correct information?
11 replies
-
Meanwhile... I know I can use an strategy like this:
- Create "custom fake" placeholders inside the rich text field (RTF1), like [field1], [field2], etc.
- Create a button and another Rich Text Field (RTF2) that will contain the resulting text
- Inside the button, create a custom script that replaces each "fake" field placeholder by the real field content, using the replace() and/or the replace() functions and writing the resulting text inside the RTF2 field
But with this solution, the user will need to always click the button or, if you don't want to create a button, insert the same script in all the fields that, when modified, will alter the content of the Rich Text Field. For example, each time you modify the client's name or age, the rich text field will be recalculated.
If anyone knows a better/cleaner/less cumbersome solution...
-
A third option is to use the trigger after update at the table level.
A fourth option is to use a formula field and html() command to combine text fields and use html to format individual parts.
-
Hi Fred Do you have a more elaborate explanation of the fourth option? The html() command inside the formula field? Then, the final text would be a formula?
-
There are smarter people who can answer this better, but there is an example of what you can do:
let xFName := Volunteer.FName; let xLName := Volunteer.LName; html("Hello <h2>" + xFName + " " + xLName + "</h2>: " + Body + "")
Lines 1 and 2 pulls data from a reference field.
Lines 3 and 4 is the html content. You see you have to get out of the HTML quotes and use the + signs to tell Ninox to use fields or variables. Body is a Rich Text field.
As you can see the Rich Text field loses it's formatting when put in a formula. Maybe someone has a better way.
-
I've made an example with both ways, Rich text field and Formula field.
If your PDF is not styled with rich text, seems you should contact support to enable this feature in your print-engine.
Content aside
- 1 yr agoLast active
- 11Replies
- 505Views
-
4
Following