0

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?

8replies Oldest first
  • Oldest first
  • Newest first
  • Active threads
  • Popular
    • Javier Gómez
    • Consultant and developer
    • Javier
    • 8 days ago
    • Reported - view

    Meanwhile... I know I can use an strategy like this:

    1. Create "custom fake" placeholders inside the rich text field (RTF1), like [field1], [field2], etc.
    2. Create a button and another Rich Text Field (RTF2) that will contain the resulting text
    3. 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...

    Like
    • Fred
    • Fred
    • 8 days ago
    • Reported - view

    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.

    Like
    • Javier Gómez
    • Consultant and developer
    • Javier
    • yesterday
    • Reported - view

    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?

    Like
    • Fred
    • Fred
    • yesterday
    • Reported - view

    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.

    Like
  • 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.

      • Rafael
      • Rafael Sanchis
      • Rafael_Sanchis
      • 22 hrs ago
      • Reported - view

      RoSoft_Steven Hi Steven 

      When I change the Name, Age and Adress and print 😣 lost the info on the PDF.

      Like
    • Rafael You mean the styling (bold,underline,etc.)? Not sure but it seems your print engine isn't capable of printing html, you can ask support@ninox.com to enable this (so I read this on the forum). In my example, I printed this with the native Mac app.

      Like
      • Rafael
      • Rafael Sanchis
      • Rafael_Sanchis
      • 12 hrs ago
      • Reported - view

      RoSoft_Steven Thanks Steven Yes I can't see the styling, I use the Web an Android on both I have the problem.

      Regards.

      Like
Like Follow
  • 12 hrs agoLast active
  • 8Replies
  • 53Views
  • 4 Following