Embed fields in text?

Does Knack have a way of embedding fields say in rich text. The idea is for form letters where the language for a particular form may be boiler plate but the text is interspersed with certain fields.

e.g. a particular sentence might be something like:

Please pay the overdue amount of {Amount Owed} by {Due Date} in order to reconcile your account.

Hello Peter,

Just create a formula field with this text.
Please pay the overdue amount of {Amount Owed} by {Due Date} in order to reconcile your account.

and add a detailed view and show this new formula field.

Sunny Singla

Thanks Sunny. But the sentence would be part of an entire form letter. How do you do that as part of a form letter?

You need to do this with a Text Formula field and create your own HTML for rich text. Then you can add other fields from the object embedded in the sentences. The one problem I have found is that the Builder has never fixed the issue of handling all html or css style code properly and often breaks so I have created a simplified version of html that I use to avoid these issues. So take a look at one of the Text Formula fields I have below. I start with a field embed tag of {open paragraph}. The Text Formulas should be able to accept a simple <p> and </p> reference but I have found the more html you use the more likely it breaks. So I just stick with my pseudocode system. I use a series of short text fields for my html like a field called “open paragraph” which is <p> and then I reference that in my code as {open paragraph} and close the paragraph with {close paragraph} which is a short text field containing </p>. Then I can write my paragraphs and embed the other data fields where they need to be. I will add an example image in a post below to show what this looks like but the example code is here:

{open paragraph}The following report has been created specifically for you using our artificial intelligence program and a vast database of health data and risk markers. The results are based on your most recent assessments, screens, tests and surveys.{line break} {close paragraph}{open paragraph}Test Date: {strong open}{Date of Measurement}{strong close} {close paragraph}{open paragraph}Your Date Of Birth - {strong open}{DOB}{strong close}{line break}Age - {strong open}{Age}{strong close}{line break}Gender - {strong open}{Gender}{strong close}{line break}Your Weight - {strong open}{Current Body Weight} {Weight Units}{strong close}{line break}Your Height -{strong open}{Height} {Height Units}{strong close}{line break}Your BMI - {strong open}{Body Mass Index}{strong close}{line break}Jackson Pollock 7-site summary {strong open}{Jackson-Pollock 7-site Summary}{strong close}{line break}Fat Body Mass {strong open}{Body Fat Percentage - Siri}{strong close}{line break}Lean Body Mass {strong open}{Fat Free Body Mass Percentage}{strong close}{close paragraph}{open paragraph}{strong open}Your Body Composition is {strong close}{strong open}{Body Fat Percentage - Siri} {strong close}{strong open}fat and {strong close}{strong open}{Fat Free Body Mass Percentage} {strong close}{strong open}lean tissue such as muscles, organs, bones and other fluids and structures.{strong close} {close paragraph}{open paragraph}{strong open}IDEAL TARGET WEIGHT GOALS{strong close} {close paragraph}{open paragraph} With your body composition data we can determine what an Ideal Target Weight would be for you at various healthy body fat levels. Note that an "ideal target weight" goal may be different from an "ideal weight" goal. A "target weight" can be a stepping stone to your "ideal weight" depending on where you are in your health journey, your objectives and style of weight-loss or gain tracking you choose with your Coach/Practitioner.{close paragraph}{open paragraph}{line break} {close paragraph}{open paragraph}{strong open}Acceptable body fat ranges are between 10 and 20 for men and 15 to 25 for women. If you have a smaller frame skeletal structure then you should target to be on the lower end of the range and if you are larger boned your target weight may be at the higher end of the range.{strong close}{close paragraph}{open paragraph}{strong open}Your Ideal Target Weight Table:{strong close}{line break}{close paragraph}{open paragraph}Goal Weight at 25 percent Body Fat: {Goal Weight at 25% Body Fat} Pounds{line break}Goal Weight at 20 percent Body Fat:{Goal Weight at 20% Body Fat} Pounds{line break}Goal Weight at 15 percent Body Fat: {Goal Weight at 15% Body Fat} Pounds{line break}Goal Weight at 10 percent Body Fat: {Goal Weight at 10% Body Fat} Pounds {close paragraph}{open paragraph}{strong open}Your next potential Goal Weight: {Goal Weight} Pounds{strong close} {close paragraph}{open paragraph}Note: If you have achieved your original weight goal the next potential Goal Weight merely represents what may be possible and should not be construed as optimal for you or for performance. This should be determined individually with your Coach/Practitioner based on your personal health and desired objectives.
1 Like

These are the codes I usually setup in an Object when I need this feature:

Remember that if your needs are simple you might try adding the HTML code right into the body of the Formula Text and see if it works first if not create the HTML code as separate fields as I explained but make sure you set the field conditions to record the HTML you require as such:

Hey Dean Bozzano,

Way cool!

Thank you so much. Very clever implementation.

Of course, now that Knack will see this, they should implement this as a feature so that you don’t have to go nuts building all the work-arounds. But at least this means we can do it.