Understanding Text Outputs

Text Outputs let you create a text file where each character in the output is under your complete programmatic control. Create JSON files for logging or integrations, DXF files for laser cutting machines, and more.


Text Output Properties

Along with the standard properties shared by most outputs, Text Outputs also have the following:

Property Example
Name The name of the output as shown in workflow rules or logs.  
Target Filename The name of the file generated.  If this is left blank, then the Name will be used. Note: the file extension of ".txt" is added automatically to all text outputs.
Text

The actual text to appear in the file.  You can...

  • Leave this field blank, and calculate the text in the output rule as shown below, or
  • Fill this field with standard boilerplate text, and replace portions of that text dynamically in the output rule. Snap offers many ways to manipulate text.

 

Creating Dynamic Text Outputs with Snap

To write to the text property, create an output rule below this Text Output, and use the "set output" Snap block:


For example, create a text file listing all the fields in a configured product, their labels, and their values.  Here, we generate text in the popular Comma Separated Values (CSV) format.


Changing the Filename Extension

All text outputs are written as files with the extension ".txt" and this cannot be changed.  To have your file saved with another extension, simply export it:

  1. Confirm the contents within your text output file are working well.
  2. In the design tree, select the "exports" folder beneath the text output file, and add a new "_custom" export.
  3. In the new custom export that appears,
    1. Set the Target Filename, or leave it blank to inherit the filename of the parent document.
    2. Set the File Extension to the extension you want appended to the target filename, such as "csv" or "json".  The "." separating the filename and extension is added automatically.
    3. Set the Target Directory only if this is built using a local builder.  If this file is built using the default cloud-based builder, leave the target directory blank.
  4. Remember to tag your export file so it can be seen by the appropriate users.


Related Topics

  • Powerful text formatting is available in Snap to help you create your text dynamically.


Was this article helpful?