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?

11 replies

null
    • Consultant and developer
    • Javier
    • 1 yr 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...

    • Fred
    • 1 yr 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.

    • Consultant and developer
    • Javier
    • 1 yr ago
    • 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?

    • Fred
    • 1 yr ago
    • 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.

    • Ninox partner
    • RoSoft_Steven.1
    • 1 yr ago
    • Reported - view

    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 Sanchis
      • Rafael_Sanchis
      • 1 yr ago
      • Reported - view

      RoSoft_Steven Hi Steven 

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

      • Ninox partner
      • RoSoft_Steven.1
      • 1 yr ago
      • Reported - view

      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.

      • Rafael Sanchis
      • Rafael_Sanchis
      • 1 yr 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.

      • Fred
      • 1 yr ago
      • Reported - view

      RoSoft_Steven Thanks for the tip of the raw() command to transfer Rich Text formatted text into html().

      • Rafael Sanchis
      • Rafael_Sanchis
      • 1 yr ago
      • Reported - view

      RoSoft_Steven 

      Thanks Steven,  Ninox support enable the print engine. 👍

      • Ninox partner
      • RoSoft_Steven.1
      • 1 yr ago
      • Reported - view

      Fred You will also like this one if you like to play around with html and use colors in your Rich text field:

      https://forum.ninox.com/t/x2h7fm9/send-emails-with-pictures-in-the-body-and-also-with-attachments-of-your-choice

Content aside

  • 1 yr agoLast active
  • 11Replies
  • 325Views
  • 4 Following