Day 7 - Data and Logic Deep Dive

Work with records that hold other records, such as an invoice and its lines: read their fields, give fallbacks, convert text to numbers, and use them in formulas, decisions and loops.

Help Centre › Getting Started

Today you work with records: values that hold other values, such as an invoice with a header, lines and totals. You will read their fields, convert text to numbers, and use them in formulas, decisions and loops.

1. Why logic matters

Logic turns a recorded list of steps into a process that adapts. With it, a bot can decide what to do from the data it reads, work through records with many levels, and calculate text, numbers and dates as it goes.

2. Records

A variable can hold a simple value (text, a number, true or false, a date) or a record. A record has named fields, and a field can hold a list or another record. Steps that read documents give you records. For example, Extract invoice data gives you an invoice like this:

{
  "general": { "number": "INV-1001", "date": "2026-10-12" },
  "from": "Acme Supplies",
  "line items": [
    { "description": "Paper", "quantity": 2, "after tax": 115 },
    { "description": "Toner", "quantity": 1, "after tax": 230 }
  ],
  "total": { "after tax": 345 }
}

Reading fields

Separate each level with ::. Lists are counted from 0.

{invoice::general::number}INV-1001
{invoice::from}Acme Supplies
{invoice::line items::0::description}Paper (the first line)
{invoice::total::after tax}345

., :, -> and a single | also work as separators, so {invoice.from} is the same as {invoice::from}. Use :: to keep things consistent. Field names with spaces work as they are; for names with dots or other separators, see Keys that contain spaces or punctuation.

Fallbacks: ||

Two pipes mean "use this, or else that". It is not a separator.

  • {invoice::general::po number || "No PO"}: the PO number, or the text "No PO" if it is empty.
  • {record::nickname || record::firstName}: the nickname, or else the first name.

More: Fallbacks.

Converting text to numbers: INT, FLOAT, STR

Values read from screens and documents are often text. Put INT, FLOAT or STR in front of the name to convert the value:

  • {FLOAT::price}: a decimal number, so "100.50" becomes 100.5.
  • {INT::invoice::total::after tax}: a whole number. Decimals are cut off, not rounded: 345.90 becomes 345.
  • {STR::count}: text.

If the value can't be converted, you get it back unchanged.

Records from documents

Steps that read documents give you records with a fixed set of fields:

3. Exercise: read a record

  1. Create a process called Invoice Read Demo.
  2. Add an Extract invoice data step that reads a sample invoice PDF into the variable invoice.
  3. Add three Log message steps:
    • Invoice number: {invoice::general::number}
    • Lines: {invoice::total line items}
    • First line: {invoice::line items::0::description}
  4. Run it and read the log in the Runs tab.

Goal: the log shows the right values from the invoice.

In real processes, keep names, ID numbers and amounts out of logs.

4. Formulas with records

  • Join fields: =CONCAT({invoice::from}, " - ", {invoice::general::number})
  • Choose by a field: =IF({FLOAT::invoice::total::after tax} > 1000, "High", "Normal")
  • Add text values as numbers: =SUM({FLOAT::price1}, {FLOAT::price2})

Every function: What calculation functions are supported.

Exercise: convert and add

  1. Add a Calculate expression step with two rows: price1 = 100.50 and price2 = 49.50.
  2. Add a third row: total = =SUM({FLOAT::price1}, {FLOAT::price2}). Rows run in order, so it can use the first two.
  3. Log Total = {total}.

Goal: the log shows 150 (or 150.0).

5. Decisions on records

Send invoices over 1000 for approval:

  1. Add a Decision with the condition {FLOAT::invoice::total::after tax} > 1000.
  2. Connect TRUE to the approval steps and FALSE to the normal steps.

Connection colours on the map: DEFAULT / TRUE in your theme's main colour, FALSE amber, ALWAYS green, EXCEPTION red.

For more than two outcomes, for example a path per supplier, use a Switch on {invoice::from}.

6. Loops over records

To work through each line of an invoice, add a For each record in list loop:

  • Variable: invoice::line items (the list to go through)
  • Loop variable: line
  • Inside the loop, read {line::description}, {line::after tax} and so on.

Exercise: sort the lines

  1. After the Extract invoice data step, add the loop above.
  2. Inside it, add a Decision: {FLOAT::line::after tax} > 200.
  3. TRUE → Log Large line: {line::description}. FALSE → Log Small line: {line::description}. Connect both back to the loop.
  4. Connect the loop's FALSE path to a final Log: Done.

Goal: one log line per invoice line, then "Done".

7. Quick reference

{a::b::c}Field c inside b inside a (also . : -> |)
{list::0::field}A field of the first item in a list
{a || b}a, or b if a is empty
{a || "text"}a, or the text if a is empty
{INT::a}, {FLOAT::a}, {STR::a}Convert to a whole number, a decimal, or text
{=FORMULA(…)}A formula inside text

8. Good habits

  • Keep field names the same across processes.
  • Prefer one record to many loose variables for complex data. It is easier to pass on and to extend.
  • Convert before you calculate. Use FLOAT or INT on values that may be text.
  • Give fallbacks with || for fields that may be missing.
  • Split long formulas into several variables so they are easy to check.

End of Day 7 summary

You should now be able to:

✅ Read fields and list items from records
✅ Give fallbacks with ||
✅ Convert text to numbers before you calculate
✅ Use records in formulas, decisions and loops
✅ Find the help pages for invoices, quotes and purchase orders

Where to go next

That is the end of the series. To go further:

Get started

See it working on your own data

Everything documented here ships with the platform – try the document tools free, or have your first automation working in 7 days.