The current {import:/mysnippet} command does not allow for variable import names such as {import:{=myvar}}. Working around this creates a lot of extra work in certain use cases, the code for which dramatically slows down TextBlaze's execution time.
For example, I have a long list of snippes with the shortcut names all prefixed with "yvfi" (e.g. "yvfiteeth", "yvfichoice", "yvfiprotein", etc.). I'd like to be able to use these in a mix-and-match fashion within the context of a repeat structure:
{note}
Total Number Of Responses: {formtext: name=responses; default=1; cols=3}
Person Being Quoted: {formtext: name=addressee; cols=50; default=You}
{endnote}{repeat: {=responses}}
{if:len(addressee)>0}{=addressee}: {endif}"{formtext: name=quote; cols=100}"
{note: trim=right}Import: {formmenu: name=mysnippet; default=choice; perfect; dairy}
{endnote}{if:{=mysnippet}=="choice"}{import:/yvfichoice}{elseif:{=mysnippet}=="perfect"}{import:/yvfiperfect}{elseif:{=mysnippet}=="dairy"}{import:/yvfidairy}{endif}
{endrepeat}
It would be much more convenient to be able to generate the import dynamically:
{note}
Total Number Of Responses: {formtext: name=responses; default=1; cols=3}
Person Being Quoted: {formtext: name=addressee; cols=50; default=You}
{endnote}{repeat: {=responses}}
{if:len(addressee)>0}{=addressee}: {endif}"{formtext: name=quote; cols=100}"
{note: trim=right}Import: {formmenu: name=mysnippet; default=choice; perfect; dairy}{mychoice="/yvfi{=mysnippet}"}{endnote}{import:{=mychoice}}
{endrepeat}
Of course, I can just enter all my imports in a long line of if/else statements. However, this causes a severe slow down in execution time, likely due to the if/then/elses being within a {repeat} structure. I'll initially have 32 choices I'll be included, but even at 15 the snippet becomes unusable due to how slow it runs. For example:
{note}
Total Number Of Responses: {formtext: name=responses; default=1; cols=3}
Person Being Quoted: {formtext: name=addressee; cols=50; default=You}
{endnote}{repeat: {=responses}}
{if:len(addressee)>0}{=addressee}: {endif}"{formtext: name=quote; cols=100}"
{note: trim=right}Import: {formmenu: name=mysnippet; default=choice; perfect; dairy; animals; foodchain; ancestors; plants; humane; honor; crops; teeth; natural; environment; iron; protein}{endnote}{if:{=mysnippet}=="choice"}{import:/yvfichoice}{elseif:{=mysnippet}=="perfect"}{import:/yvfiperfect}{elseif:{=mysnippet}=="dairy"}{import:/yvfidairy}{elseif:{=mysnippet}=="animals"}{import:/yvfianimals}{elseif:{=mysnippet}=="foodchain"}{import:/yvfifoodchain}{elseif:{=mysnippet}=="ancestors"}{import:/yvfiancestors}{elseif:{=mysnippet}=="plants"}{import:/yvfiplants}{elseif:{=mysnippet}=="humane"}{import:/yvfihumane}{elseif:{=mysnippet}=="honor"}{import:/yvfihonor}{elseif:{=mysnippet}=="crops"}{import:/yvficrops}{elseif:{=mysnippet}=="teeth"}{import:/yvfiteeth}{elseif:{=mysnippet}=="natural"}{import:/yvfinatural}{elseif:{=mysnippet}=="environment"}{import:/yvfienvironment}{elseif:{=mysnippet}=="iron"}{import:/yvfiiron}{elseif:{=mysnippet}=="protein"}{import:/yvfiprotein}{endif}
{endrepeat}
If I'm correct that the slowdown is coming from all the if statements being reevaluated, then a dynamic {import} should fix the problem in this use case.