Session 22: External data L1

Preparation

  • Please download this content here.

Description

This tutorial examines the use of standard .txt files and .xml files to populate templates: L1

Session specific objectives

Understanding differing external data usage and requirements in Swift templates: L1

Chapter 1: Populating a template from a standard .txt file

  • Common uses and example
  • Constant Sources
  • Script Value Destinations
  • Integer Data Types

Chapter 2: Populating a template from an .xml file

  • Common uses and example
  • File Sources
  • Method Data Destinations
  • File Access String queries

Expected duration

30 minutes

User Level

All new users

Ruby Basics by Darrell James

To find where you can download Ruby, open the Ruby Basics guide here and follow the installation instructions.

 

Chapter 1 crib

User code for the bringOn

#Set the file and path using quotes and double backslashes
file = File.open("your path and filename", "rb")
contents = file.read

#Set the input as _ underscored + input name
_Contents = contents
data.setInputValue("bringOn", "contents", _Contents)

 

Chapter 2 crib

User code for the bringOn

$filename = _filename

File Access Strings for the GetData input:

textUpper:=/data/Sheet1/*[[line1]]/@name
textLower:=/data/Sheet1/*[[line2]]/@name

 

Session Project

If you want to review Justin Avery's instructor project at this point in the course, you can download the project zip here.