Import Snippets using multiselect

Hey All,

I had seen a post somewhere but I am not able to find it now. I am using the following snippet to import few other snippets based on multiple options.

{note}{formmenu: name=options; multiple=yes; default=Leave of Absence; Disclosure of Interest; Approval of Financials; Approval of Directors Report}{endnote}

{repeat: for i in seq(1, count(options))}
{=i}. {=options[i]}
{endrepeat}

I want to import respective snippet just after the point is mentioned.

I am not able to understand how to do it, can someone please help. This list can go upto 20-25 points, I would also like to know the best way of creating the snippets as well so that if any more points to be added in future, can be easily added or edited.

@Gaurang_Tandon I would also like to have your help here in case if we can grab all these options from Airtable directly.

Thank you for your help.

Hi Pratik, sure I'll be happy to help with the latter part. Although I am not sure how to do the first part. I tried the very simple:

{name="foo"}
{import: {=name}}

But that does not work. Perhaps @Cedric_Debono_Blaze will have some better suggestions :slight_smile:

1 Like

Thanks Gaurang. I did some trial and error using the codes given by you for Airtable. I could actually achieve what I wanted but it is actually stuck where the {import} function does not work director from airtable.

If you see above image, both the list of "Agendas" and "Snippets" are coming from Airtable. Now the only problem here is that {import} function is not working which is dynamically created from Airtable data.

@Cedric_Debono_Blaze can you please help me in this, if you have better idea to achieve this. Thank you both of you.

@Cedric_Debono_Blaze @Gaurang_Tandon
UPDATE:

I have got this working somehow. Instead of getting snippets from airtable, I am manually adding it in to Snippet using IF function.

{repeat: for i in seq(1, count(chosen_record))}
{=i}. {if: i == "1"}{import: /loa}{elseif: i == "2"}{import: /approvefin}{elseif: i == "3"}{import: /approvedir}{endif}
{endrepeat}

If you guys have better way of doing this, please let me know, it would really be helpful.
Thanks

1 Like

Sorry to bother you again. This is not achieving 100% of what I want.
Can I connect with any of you and help me with a solution? Thanks

Hi @Pratik_Shah

Drop me an email on cedric@blaze.today and let's set up a call so we can build it together :slight_smile:

1 Like

Thank you @Cedric_Debono_Blaze for the reply. I guess I have achieved what I wanted now after trying for last few hours.

{repeat: for i in seq(1, count(chosen_record))}
{=i} {if: {=chosen_record[i].fields["Agenda"]} == "Approval of Financial Statements"}{import: /approvefin}{elseif: {=chosen_record[i].fields["Agenda"]} == "Approval of Directors Report"}{import: /approvedir}{endif}
{endrepeat}

The only issue here is that, I have to create the IF command manually with 30-35 options and could be little inconvenient if I want to change anything.

Do you have a better way to do this? I will anyway write an email to you as I want to automate creating this IF command instead of manual, if you can help me in this.

Thanks

@Pratik_Shah

Let's jump on a call. I'm sure there's a way to make your life easier :slight_smile:

1 Like