Master Form with multiple snippets

Please link to the answer if I missed the thread in my search.
I am curious if we can create a "master form" so after using multiple snippets in a large document, the pronouns, name, etc. are all consistent through the pages.

Thanks!

Hi @Ricki_Gillespie

If you use several snippets separately, there's not anything that ties them together and you'll need to ensure that data is correct. That is, if you use one snippet that has a field called First Name and then a second snippet with First Name, you'll just need to make sure that you enter the first name accurately both times.

You can use the import snippet command to bring multiple snippets together into a single snippet. In that case, if your two snippets share variable names (e.g. both have a field called First Name), then those fields will automatically share the same value.

If you're trying to build one "main" snippet, you could set it up so that it imports other snippets based on your selections, like having toggle boxes that import snippets or dropdown menus that import snippets. Examples in the community can't show actual importing, but those would look like this:

Example using Toggle Fields
{formtoggle: name=Use Snippet A}{formtoggle: name=Use Snippet B}{formtoggle: name=Use Snippet C}{formtoggle: name=Use Snippet D}

{if: `Use Snippet A`}{import: /snippetA}
{endif}{if: `Use Snippet B`}{import: /snippetB}
{endif}{if: `Use Snippet C`}{import: /snippetC}
{endif}{if: `Use Snippet D`}{import: /snippetD}{endif}

Example using Multiple Select Dropdown
{formmenu: Use Snippet A; Use Snippet B; Use Snippet C; Use Snippet D; multiple=yes; name=dropdown}

{if: includes(dropdown, "Use Snippet A")}{import: /snippetA}
{endif}{if: includes(dropdown, "Use Snippet B")}{import: /snippetB}
{endif}{if: includes(dropdown, "Use Snippet C")}{import: /snippetC}
{endif}{if: includes(dropdown, "Use Snippet D")}{import: /snippetD}
{endif}

You can also set up a section at the top of any snippet where you do all of your customization, and then those values get populated throughout the snippet. Instead of putting the fields in context in the generated text, you put them at the top of the snippet and then place their values throughout the snippet instead, like this:

{note}Patient name: {formtext: default=Example Name; name=name}
Patient DoB: {formdate: MM-DD-YYYY; name=DoB; default=06-21-1986}
Patient Complaint: {formtext: default=insomnia; name=complaint}
Recommendations: {formparagraph: default=Advice A, Advice B, and Advice C; name=recommendations}{endnote}

Patient {=name} visited today with concerns about {=complaint}. Due to {=name}'s age (date of birth {=DoB}), issues with {=complaint} are common. I recommended {=recommendations}. {=name} was happy with the recommendations about how to deal with {=complaint} and will follow up in 2 weeks.

1 Like