0

Interpolate String

  • updated 9 mths ago

Description

This is a process node part that will safely interpolate text (ie resolve all variable constructions and create a text string complete with any HTML structures).

While this part has a wide variety of uses, two of the most common are:

  • to safeguard any text input that could be used to execute malicious code
  • to prepare dynamic text prior to printing to PDF

In Release 7.4 on, the part has the added feature of being able to run interpolation twice, on two different contexts (scope) which is useful when building a text string such as a query, and when the query base (fhir_query) and target value (_startvars.patient_ref.fhir_patient_id) are in different contexts, as in the example below.

 fhir_query = "Condition?patient=$(fhir_patient_id)",
      _startvars = {
          patient_ref = { fhir_patient_id = "123" }
                   }

Editor Fields

Field Name Description/Use Type/ Options Mandatory/
Optional
path Enter the name of the data object where the result of the interpolation should be stored data object M
content Enter the variable name (or text) that needs to be interpolated, using the $(...) construction text M
Ist Interpolation      
context The scope or context in which to find the content variable.
By default, the current application context is used, but when a specific context is named, the interpolation will only look at the data-objects inside the named context. 
text O

Escape $(...)-content

(v7.4+)

Check this box if your content includes $(..) variables that should NOT be encoded. 
Example:

mytext = "<b>Hello</b>
$(mytext) will appear as Hello (off) or <b>Hello</b> (on)

If the content contains several interpolations only some of which need to be escaped, use the $(html(mytext)) construction to turn off escaping for specific variable. 

On|Off M

2nd Interpolation

(v7.4+)

This part can perform 2 step interpolation, which means that the result of the first interpolation is interpolated again.
This is a specific use case when the interpolation of  data objects requires two different scopes.

In the example below, interpolating $(main_context.caption) will return This is my name: Person X unless in the 2nd interpolation the Designer specifies the context as other_context.person1 

Download the example project into your Designer to see this working.

context As above text O

Escape $(...)-content

(v7.4+)

As above On|Off M

Example Project

An example project containing a simple demonstration of the 1st and 2nd interpolation is available here.

Reply Oldest first
  • Oldest first
  • Newest first
  • Active threads
  • Popular
Like Follow
  • 3 yrs agoLast active
  • 47Views
  • 3 Following

Home