What if you want to create a relatively complex text file in Switch? Say… something like an XML file, or a JDF, or a complex JSON file. Yes, you can write a custom script for this, but even with a script, doing this is still very messy and a lot of hard and painstaking work. If only there would be a way to make that easier…
Wait a minute, when you’re generating HTML files for a web site, isn’t that very much the same problem? How do those systems deal with that? Turns out that smart people invented something called a templating engine. You provide a template and can then insert variables in that template in a structured way. Modern templating engines even allow you to create loops, insert conditionals and so on.
This Switch app uses a templating engine – Embedded JavaScript templating, or EJS – to do exactly this. The app has different ways to specify where the template is and to specify input variables for the template. It builds the output from the template injected with these variables and then outputs it according to what you need in the rest of the workflow.
The sky is the limit! :) However, some practical examples would be:
Of course you can write a custom script for this (well, if you have access to the scripting module that is). But scripts to write complex text files very quickly become messy. Using this app has the advantage that you separate the business logic from the presentation. Use a script to attach information to a job, or to generate a custom JSON file. Then use this app and a custom template to format your information into the output format you want. Doing things this way both your script and the template become simpler and are more easily maintainable.
Yes, we also have things we find complex and we rather have someone else do for us. This app and the templates it uses we do understand quite well. So get in contact with us and see how we can help you to prepare the template you need (or any other problem you're trying to solve using Switch).
This is a great app that makes it easy for me to generate jdf's on the fly, huge possibilities for a very easy to use app.