split(): pull the email out of a CSV line
Medium
A contact import reads one line per person: name,email,city. Return the email, the second field, without the spaces people type around it.
Some lines are too short to have an email, and some have it left blank. Both come back as "missing".
Input
ri!line: Text
ri! Rule Inputs
ri!lineText"Ann, ann@example.com ,Pune"
Example 1: Spaces around the email
Input: ri!line
"Ann, ann@example.com ,Pune"
Expected output:
"ann@example.com"
Example 2: No city given
Input: ri!line
"Di,di@example.com"
Expected output:
"di@example.com"
Example 3: Only a name
Input: ri!line
"Bo"
Expected output:
"missing"
Example 4: Email left blank
Input: ri!line
"Cy,,Delhi"
Expected output:
"missing"
Example 5: Email is only spaces
Input: ri!line
"Ed, ,Goa"
Expected output:
"missing"
Appian Expression Tips
- • Use
ri!variableNamefor rule inputs - • Use
a!localVariables(local!x: …, body)for locals - • Use
a!forEach(items: …, expression: fv!item)to iterate - • Use
where()/reject(fn!isnull, list)to filter