> For the complete documentation index, see [llms.txt](https://community-test.logicnets.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://community-test.logicnets.com/release-9/platform-documentation/process-node-parts/interpolate-string.md).

# Interpolate String

## 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 | <p>Mandatory/<br>Optional</p> |
| ---------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------- | ----------------------------- |
| 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                                              | <p>The scope or context in which to find the content variable.<br>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.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         | text          | O                             |
| <p>Escape $(...)-content<br>(v7.4+)</p>              | <p>Check this box if your content includes $(..) variables that should NOT be encoded.<br>Example:<br><code>mytext = "\<b>Hello\</b></code><br><code>$(mytext) will appear as Hello (off) or \<b>Hello\</b> (on)</code><br>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.</p>                                                                                                                                                                                                                                                                                                                                                                                   | On\|Off       | M                             |
| <p><strong>2nd Interpolation</strong><br>(v7.4+)</p> | <p>This part can perform 2 step interpolation, which means that the result of the first interpolation is interpolated again.<br>This is a specific use case when the interpolation of data objects requires two different scopes.<br>In the example below, interpolating $(main\_context.caption) will return <em>This is my name: Person X</em> unless in the 2nd interpolation the Designer specifies the context as <em>other\_context.person1</em><br><img src="https://2802811211-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdFhfexCjZ5JMhwGzzywq%2Fuploads%2Fgit-blob-fcd05306e02d4c04220282d5dfe8cc095bbc398f%2Ffc1579d4-e6a4-423e-8d3d-d3988a20cc61.jpg?alt=media" alt=""><br>Download the example project into your Designer to see this working.</p> |               |                               |
| context                                              | As above                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                | text          | O                             |
| <p>Escape $(...)-content<br>(v7.4+)</p>              | As above                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                | On\|Off       | M                             |

## Example Project

An example project containing a simple demonstration of the 1st and 2nd interpolation is available [here](/release-9/example-gallery/example-projects-for-parts/interpolate-string-example-project.md).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://community-test.logicnets.com/release-9/platform-documentation/process-node-parts/interpolate-string.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
