Can you import information contained within another snippet

I have a number of different medical SOAP templates that import various categories of discussion based on the specific details of each appointment. In these SOAPs, there is a section where the medications dispensed must be listed in a list format. Is it possible to use information inserted from these imported snippets to create that list?

For example, in the following template:
Capture

in the /ppc imported snippet, the user will fill out what parasite prevention medication was purchased (if any) (see image below) - is it possible to somehow extract that information and list it in the medication list when it is from an imported snippet?

ppc

Hi @mildmayveterinary! :wave:

Thank you for sharing this with us and I am happy to do my best to help! Quick question for you - where is the "Medication List" housed? I understand you are selecting which medicines have been purchased in /ppc, but are those needing to be extracted somehow into /EDIT or somewhere else entirely?

Hi Oliver, thanks for your help!
You are correct, I would like to extract them and put them in a list format under a title listed "Medications" which is basically just a summary of all medications dispensed at the visit. Ie. If in the imported /ppc snippet I type "medication A", I would like "medication A" to auto input itself into the medication list on the /EDIT snippet; I'm just not sure how to do this since the information is being inserted into a imported snippet. Please let me know if further clarification is needed.

Understood and thank you for clarifying! I'll run this by one of our engineers and I'll come back to you as soon as I have a fix for this or determine whether it is or is not possible.

Hi @mildmayveterinary! Thank you for your patience while I investigated a solution for you here. Please see below:

Form variables are shared across the main snippet and any imported snippets. So if a form variable is defined in one imported snippet it can be used in other imported snippets.

So if you have an imported snippet that defined meds1 and another that defined meds2, these could be merged together and displayed in a third imported snippet with something like {=join(merge(meds1, meds2), "BLAZE_AND"))}

I made a little walk-through video for you going through the steps here.

Hope that helps! Please let us know if you need more help with this.

1 Like

@mildmayveterinary - quick tip on top of Oliver's great solution...

Remember to use the trim command to keep the snippet output clean. I'll use a snippet similar to Oliver's for reference so you can follow more easily.

{note: trim=right}
{formmenu: name=menu1; item 1a; item 1b; item 1c; multiple=yes}
{formmenu: name=menu2; item 2a; item 2b; item 3c; multiple=yes}

{endnote: trim=right}

{=join(merge(menu1, menu2), "BLAZE_AND")}

If you look at the screenshot below, you'll see a red arrow pointing at the endnote command, which has this symbol inside it >|

image

This means that all white space (empty lines too) after that command will be removed when the snippet is inserted. Try it out and you'll see what I mean :slight_smile:

Also, try experimenting with the number of empty lines both before and after that endnote command. You'll notice something interesting... :face_with_monocle:

1 Like

Thank you very much for your help! 2 follow up questions

  1. when I use the join formula with the lists tilted things like "med1" it works perfectly, however, if I name the lists something like "External parasite prevention" I get errors when I try to make the join formula (it says "unexpected "p") - can you not have spaces in the names?

  2. is it possible to do this without a drop down menu? ie. if it were to be a blank text field they would manually type the med into?

A dropdown menu is a form field, and so it a text field. Both can have a label attributed to them, which can then be used within the join() function or other applicable functions.

Here's what I mean:

Text Field: {formtext: name=text; default=some text in a text field}
Menu Field: {formmenu: name=menu; default=entry 1; entry 2; entry 3}

{=concat(text&" plus "&menu)}

In the example above, I'm using concat() to combine the text from the text field with the choice from the menu field, and adding the string of text " plus " between them.

With regards to form names containing spaces, it is possible to have them, but they need to be surrounded by backticks like this:

`name with spaces`

I generally advise against using spaces in form names, because it's easy to make mistakes with them, especially if you're dealing with big snippets.

Additionally, here's something that might be a good solution for your second question:

Remember, you can copy the snippet examples directly to your dashboard from the forum. Just click on "Copy to Text Blaze"

image

1 Like

So sorry for all the questions, but what does it not like about this formula (Parasite prevention purchased is the name of my list)?

Capture2

Hi @mildmayveterinary,

For variable names you have to use backticks instead of single quotes like this: {=join(`Parasite prevention purchased`, "BLAZE_AND")}.

1 Like