Page 1 of 1

Variables, Snippets, Conditions - Outthinking myself - Help?

Posted: Tue May 02, 2017 1:57 pm
by LookingForHelp
Situation:
1 Output.
50 topics. Topic = Contract Information.
Each topic has 5 snippets.
Each snippet is formatted with standardized content and layout.

One example of a smaller snippet is Contact Info which has
[*]Main Phone Number
[*]Phone Tree 1 Option
[*]Phone Tree 2 Option
[*]Phone Tree 3 Option
[*]Phone Tree 4 Option

I was planning on creating a Variable Set of 50 ContractName (one for each topic) with variables likes:
ContractName.PhoneNumber
ContractName.Tree1
ContractName.Tree2
ContractName.Tree3
ContractName.Tree4

I'm stuck on trying to insert the System.Title as ContractName to make it truly set and forget snippet and as such I'm kinda stuck. I feel like I've wandered down the rabbit hole too far to see how I should set this up.
Help me Obi Wan...

Re: Variables, Snippets, Conditions - Outthinking myself - H

Posted: Tue May 02, 2017 3:26 pm
by Nita Beck
Sorry but I'm having trouble figuring out what you're trying to do. You say you will have a "Variable Set of 50 ContractName (one for each)..." One for each what? And why do you want to use the built-in System.Title variable as ContractName? (Sorry, it's been a long day...) Do you need both variables and snippets to populate the phone numbers? Can you get away with just snippets?

One of my foundational design principles is that, when faced with complexity, I always seek the simplest solution. The simplest solution is easier to implement, to document (so another Flare author understands the design), and to maintain (by oneself and/or another Flare author).

Re: Variables, Snippets, Conditions - Outthinking myself - H

Posted: Tue May 02, 2017 4:07 pm
by LookingForHelp
* Edited (one for each topic)
Hi,
What I'm trying to do is have a snippet for a skeleton of a table with variable placeholders for each piece of contact information in those table cells.
Insert that snippet in the ContractName Topic. Ideally I would love it if it could read the System.Title so it would then pull the appropriate ContractName.Variables into that snippet without the need for heavy lifting:
"I'm in ContractABC Topic so I'm going to use the ContractABC VariableSet."

Topic - ContractABC.htm
Generic Snippet - Contactinfo.flsnp
Variable - ContractABC.flvar

Flare might do it natively - hence System.Title idea to help with mapping? Maybe some clever javascript?

Thanks for any brain inputs :)

Re: Variables, Snippets, Conditions - Outthinking myself - H

Posted: Wed May 03, 2017 6:26 pm
by Nita Beck
I think what you're seeking isn't something that Flare is programmed to do. I personally have no idea if you could create a Flare plug-in or add any Javascripting as you've suggested. Sorry. :( Perhaps someone else has an idea.

Re: Variables, Snippets, Conditions - Outthinking myself - H

Posted: Wed May 10, 2017 5:09 am
by NorthEast
So you have 50 topics, and are going to create 50 variable sets, one for each topic.

But if the variables are just static text though, and don't change per output, then why bother using variables?
It'd be easier to type in the information directly into the topic, and not use variables.

You could use a snippet as a template for the topics; e.g. create the topic layout in the snippet, insert it into each topic, then convert the snippet to text.


As for javascript - bear in mind that javascript is run by the browser in the built output. Variables are are applied as part of Flare's build process, meaning no javascript can be run at this point, so you can't use javascript to interact with Flare variables.