Create file from template

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. The “Create file from template” app makes this process ridiculously simple, while still offering a whole lot of flexibility.

How can we help?

Create text-based files in Switch

This Switch app uses a templating engine – Embedded JavaScript templating, or EJS – to generate text files on the fly. You create an EJS template that generates the type of text file you’re interested in and specify the variables that are going to be replaced in your template. The app does the heavy lifting for you and outputs the resulting text file exactly there where you need it in the rest of your workflow.

The power of EJS templates

An EJS template is just a text file by itself. You use it to specify all the fixed parts of what you want to output; perhaps simple text, perhaps the basic structure of an HTML, JDF or XML file. Then, you add placeholders to the template that are going to be substituted for the variable content. EJS templates allow very simple placeholders, but you can go as far as using JavaScript code in them as well for even more power.

Determine output flexibly

Perhaps you need the output file in the output folder of the app? That’s entirely possible. But perhaps that’s not very useful, and it would be better to attach it to the incoming job as a dataset? Also possible. And it’s even possible to choose a fixed location on disk where you would like the app to write the file for you.

Keep adding to files

What if you don’t want to generate a new text file for each job that passes through your flow, but you want to keep adding to the same output file? Perhaps you want to generate a CSV file with job related information so at the end of each day you have an overview of orders? The app allows you to do exactly that; you can use a template that creates the output file if it doesn’t exist yet, but simply adds to it if it existed already.

Kan ik
je helpen?

Hey, ik ben Tom!

Ik ben jouw contactpersoon. Weet je niet waar je moet beginnen? Bel me, plan een videocall of stuur me een e-mail. Ik ben een en al oor. We komen er samen wel uit!

Stay tuned

Please leave your e-mail adress in order to receive our newsletter.