Skip to content

Validate data

A check is a condition and an exception: where the condition finds a problem, raiseException files a ticket in Exception management for that row. The row stays in the output, so a check never loses data, and exports downstream can wait until the tickets are resolved.

if(
empty(prop("price")),
raiseException("price", prop("trade_id"))
.setProp("message", "Price is missing")
.setProp("severityLevel", 4)
.setProp("type", "Pricing")
)

raiseException() records an exception for the current row. Chained .setProp calls set the ticket’s fields, not data columns:

Field Value
message The message shown on the ticket
severityLevel (or severity) A whole number from 1 to 5
type A label that groups tickets, such as "Pricing"
Any other Exception Management field status, assignee or assigneeUserId, deleted, or a custom property, by its id or name

Field values are stored when the ticket is first created. A name that is not a field on this workflow still raises the ticket and records a field error. A literal severity outside 1 to 5 is an editor error; a computed one outside that range still raises the ticket without a severity and records an error on that field.

Pin the ticket to a column and an identity

Section titled “Pin the ticket to a column and an identity”

Two optional arguments say which column the ticket is about and what makes it the same ticket on the next run:

Form Column Identity across runs
raiseException() None The content of the raising row
raiseException(field) field The content of the raising row
raiseException(field, key) field key, a text or number expression

With a key, the same key on a later run updates the existing ticket, and a key a later run no longer raises makes its ticket inactive. That is how corrected source data resolves the exceptions it raised: fix the price, run again, and the ticket for that trade closes.

Without a key, the identity is the row’s content, so a row that changes in any column raises a new ticket. Use a key built from the row’s business identity, such as prop("trade_id") or concat(prop("account"), ":", prop("ISIN")).

Raising an exception never stops a node: at every severity the node keeps all its rows, finishes with its usual status, and runs the nodes after it. Only a run failure, such as division by zero, fails a node.

The node’s output port counts its exceptions in three bands, and the wire from it takes the colour of the worst one:

Severity level Counted as
1 or 2 info
3 warning
4 or 5 error

A node waits for exceptions only when its own trigger condition says so. Exporting nodes start with a condition that holds them back while any node upstream has a warning or an error; see Export data.

The severity is stored on the ticket when it is first created. Raising the same ticket later with another level changes the port’s counts in that run and leaves the ticket’s severity as it is; change it in Exception Management.

To file a ticket and also leave the row out of the output, put both in one do(…). The ticket outlives the dropped row:

if(
prop("owner").empty(),
do(
raiseException("owner")
.setProp("message", "Owner is missing")
.setProp("severityLevel", 3),
dropRow()
)
)

When a cell holds a list, such as the legs of a trade, each(list, statement) runs a check once per item on the row that holds the list. current is the item and index its zero-based position:

each(
prop("legs"),
if(
empty(current.prop("ISIN")),
raiseException("legs", concat(prop("trade_id"), ":", format(index)))
.setProp("message", "Leg has no ISIN")
)
)

Inside each, always write raiseException(field, key), with a key that tells both the row and the item apart. The key above joins the trade id and the leg’s position, so every leg keeps its own ticket and a leg a later run no longer raises closes alone. format(index) on its own would give the first leg of every trade the same identity.

each does not change the list or the rows: dropRow, filter, keepProps, and the row-set statements are not allowed inside it.

Check Condition that raises
Required value empty(prop("owner"))
Valid ISIN, with its check digit not(isValidIsin(prop("ISIN")))
Pattern, such as an email address not(test(prop("email"), "^[^@\\s]+@[^@\\s]+\\.[^@\\s]+$"))
Starts with a prefix not(test(prop("account"), "^GB"))
Allowed values not(["BUY", "SELL"].includes(prop("side")))
Number in range prop("rate") < 0 or prop("rate") > 1
Text length length(prop("LEI")) != 20
Uppercase prop("ccy") != upper(prop("ccy"))
Date not in the future prop("trade_date") > today()
Dates in order prop("settle_date") < prop("trade_date")
Value exists in a reference table empty(inputs().prop("securities").find("ISIN", prop("ISIN")))
Matches the reference value prop("ccy") != inputs().prop("securities").find("ISIN", prop("ISIN")).prop("ccy")

Wrap each condition in if(condition, raiseException(…)). Regular expressions are JavaScript patterns written as text, so a backslash is doubled inside double quotes. There is no startsWith or endsWith: test ^ and $ patterns instead.

A check that reads a number guards against empty values first, because arithmetic and comparisons on an empty number fail the run:

if(
not(empty(prop("rate"))) and (prop("rate") < 0 or prop("rate") > 1),
raiseException("rate", prop("trade_id")).setProp("message", "Rate is outside 0 to 1")
)