PadCodedocs

Load File

Reads one of this app's own files (Assets → Files) into a variable: a JSON file as its values, a CSV as a list of rows, anything else as text.

Category: Data · Can fail (wrap it in Try to handle that) · Takes time: the next step waits for it

#When to use it

Use it to bring in data you ship with the app, like a menu, a list of questions or starting records, from a JSON or CSV file under Assets → Files.

#Example

The menu screen's When Loading: Load File with File: menu and Into: menu. A Repeater linked to menu shows each dish.

#Good to know

  • A JSON file becomes its values. A CSV becomes a list of records, one per row, with fields named by the first row. Any other file becomes its text.
  • If the file isn't in Assets → Files, the step fails. With no files there yet, File says Add one in Assets.
  • Your app reads the file; it never changes it.

#Add it

Select a view, open the Inspector's Actions tab, pick when it runs, tap Add action and choose Load File (under Data). Tap the step to open its settings.

#Settings

SettingWhat it doesKindDefault
FileOne of this app's files.File (from Assets)Required
IntoWhere to save what it holds.VariableRequired

#What it gives back

A JSON file's values; a CSV's rows, each a record named by the first row; or the text.

#See also