The split() function in Appian divides a text value into a list of substrings based on a delimiter, returning a list of text values. For example, split("apple,banana,cherry", ",") returns {"apple", "banana", "cherry"}. This function is essential for parsing CSV data, breaking apart user input, or processing delimited strings in expressions.
Background: Why Split Exists in Appian
Appian is a low-code platform where business processes often need to handle text data from external systems, user forms, or database fields. A common pattern is receiving a comma-separated list (like email addresses or product IDs) that must be processed individually. The split() function was introduced to provide a straightforward, built-in way to break such strings into manageable lists, avoiding the need for complex loops or custom plug-ins. It mirrors similar functions in other languages (like split in Java or explode in PHP) but is tailored to Appian’s expression language.
How Split Works: Syntax and Parameters
The syntax is simple: split(text, delimiter). Both arguments are required and must be text values (or expressions that evaluate to text). The function scans the input text and returns a list of substrings, splitting at every occurrence of the delimiter. The delimiter is case-sensitive and can be a single character or a multi-character string. For instance:
split("2024-01-15", "-")returns{"2024", "01", "15"}.split("a;b;c", ";")returns{"a", "b", "c"}.split("hello world", " ")returns{"hello", "world"}.
If the delimiter is not found, the function returns a list containing the entire original text as a single element. If the text is empty, it returns an empty list. If the delimiter is empty, Appian returns an error because an empty delimiter is ambiguous.
Choosing the Right Delimiter
Selecting the correct delimiter is critical. If your data uses commas, spaces, or pipes, you can use those directly. However, beware of delimiters that appear within the data itself. For example, splitting a sentence by spaces works, but if the text contains multiple consecutive spaces, you’ll get empty strings. To handle that, you might need to use a regular expression via splitregex() (a related function) or pre-process the text. Also, note that the delimiter is literal—you cannot use a regex pattern with split(). For complex patterns, use splitregex(), which accepts a regex pattern.
Common Problems and Solutions
One frequent issue is dealing with leading or trailing delimiters. For example, split(",a,b,", ",") returns {"", "a", "b", ""}—including empty strings. This can cause errors if you expect only non-empty values. You can filter them out using filter() or wherecontains(). Another problem is that split() is case-sensitive; if your delimiter might appear in uppercase or lowercase, you may need to normalize the text first using upper() or lower(). Also, remember that the function returns a list, not an array—Appian lists are 1-indexed, so the first element is at index 1, not 0.
Split vs. Other Text Functions
Appian offers several text-manipulation functions that overlap with split(). substring() extracts a portion of a string, left() and right() get characters from the start or end, and find() locates a substring. However, split() is unique in that it returns a list of all parts. For example, if you need the first word of a sentence, you could use split() and then index, or use left() with find(). The choice depends on whether you need all parts or just one. Also, splitregex() is more powerful for complex delimiters but is slower and requires regex knowledge.
Performance and Best Practices
When processing large texts, split() can be memory-intensive because it creates a list of all substrings. Avoid splitting huge strings unnecessarily; if you only need the first few elements, consider using left() and find() to extract them. Also, be mindful of delimiter choice—a simple comma is faster than a multi-character delimiter. In expressions that run frequently, like in process models, minimizing the number of split() calls can improve performance. Use split() in conjunction with count() to determine how many items are in a list, or with index() to access specific elements.
Alternatives to Split
If split() doesn’t meet your needs, consider these alternatives:
splitregex(): Allows regex patterns, e.g.,splitregex("a1b2c3", "[0-9]")returns{"a", "b", "c"}.parseJson(): If your data is JSON, parse it directly into a dictionary or list.tolatext(): Converts a list to a delimited string (the inverse of split).- Custom expression rules: For complex parsing, you can write a rule that loops through characters.
For example, to split on multiple delimiters (like commas or semicolons), you could first replace one with the other using replace(), then split.
Frequently Asked Questions
Q: Can I split a string by multiple different delimiters at once?
A: No, split() only accepts a single delimiter string. To split on multiple delimiters, you can first normalize them to one using replace(), or use splitregex() with a pattern like "[,;]".
Q: What happens if the delimiter appears at the end of the string?
A: The function returns a trailing empty string. For example, split("a,b,", ",") returns {"a", "b", ""}. You can remove empty strings using filter() or wherecontains().
Q: Is split case-sensitive?
A: Yes, the delimiter must match exactly. If you need case-insensitive splitting, convert both the text and delimiter to the same case first (e.g., using lower()).
Q: Can I split a number or a list?
A: No, split() only works on text values. To split a list, you would need to convert it to text first (e.g., using totext()) and then split, but that’s rarely useful.
Q: How do I get the last element after splitting?
A: Use index(split(text, delimiter), count(split(text, delimiter))). For example, index(split("a,b,c", ","), 3) returns "c". You can also use last() on the list.
Q: Does split handle newlines or tabs?
A: Yes, you can use escape sequences like char(10) for newline or char(9) for tab as the delimiter. For example, split("line1 returns
line2", char(10)){"line1", "line2"}.
Related
- Physics Wallah Balance Sheet: Key Financials
- Balloons with Metallic Numbers: Sizes, Filling, and Safety
- Split a String in BigQuery? SQL Methods
Try it: the Formula Explainer: paste any formula and see each function and reference in plain English.
More in Formulas & functions
- Excel Formula for Mileage Calculation: How ToThe core Excel formula for mileage calculation is simple: =EndOdometer - StartOdometer for distance, or =MilesDriven * RatePerMile…
- Excel Formula to Password Protect a Sheet? What WorksNo Excel formula can password-protect a worksheet: formulas calculate values, but they cannot set sheet permissions or require…
- Multiply Time by a Number in Excel: Formula and TipsTo multiply a time value by a number in Excel, enter a formula such as =A2*B2, where A2…
- How to Hide Filter Arrows in Excel and Keep Table FiltersTo hide filter arrows in Excel without removing a table’s AutoFilter setup, click inside the table, open Table…
- CLEAN TRIM Formula in Excel: Remove Extra SpacesIn Excel for Microsoft 365, use =TRIM(CLEAN(A2)) to remove many nonprinting control characters from a cell and trim…
- Flip Names in Excel in the Same Cell With a FormulaTo flip a name such as John Smith to Smith John in Excel for Microsoft 365, enter a…
Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources
Spotted an error in this guide? Let us know.