You need to adjust the logic in your flow. Relying on a single split() function isn't ideal as the array will not output the same number of items each time.
Refer to
this section of my YT Tutorial linked below for more details on the split() function. Tip: Rename your compose actions to keep your flow organized. It will make it easier to identify which Compose action has what output.
Compose – Split at Cultur Pricing
You can split a string with another string. In this case you can split your subject line by ' Cultur Pricing' (include the space before). This will return an array that should look something like this:
[
"13919 Woolco Foods Cultured Ac",
"Oct 2024"
]
Important: You indicated that one of your subject lines included a Cu before Cultur Pricing. This can pose as an issue. You might need to add a condition to filter out those subject lines and adjust your expression.
Compose – Customer Number
Use the first() function on the output of the Compose action above. Run a test. It should output the first item of the array.
Wrap the expression in the split() function and split that string with a space. Run a test. The output should look like this:
[
"13919",
"Woolco",
"Foods",
"Cultured",
"Ac"
]
Click the expression to edit it. Since the customer number will always be the first item, use the first() expression. Wrap the expression in the first() function. Run a test. If you aren't clear on what wrapping an expression means—check out my tutorial linked below.
Compose – Date
The date is in the last item of the array (Compose – Split at Cultur Pricing). Use the last() function and insert the output from the Compose – Split at Cultur Pricing. Run a test. This should output the date.
----
7 Functions You Need to Know | ⚡️Expression Essentials: Part 1⚡️
In this section, I'll cover how to get dynamic content with an expression when the dynamic content you need isn't listed in the dynamic content menu.
In the full tutorial I cover 7 functions you need to know when getting started with expressions.
1️⃣ empty()
2️⃣ coalesce()
3️⃣ equals()
4️⃣ if()
5️⃣ concat()
6️⃣ length()
7️⃣ split()
I cover how to use these functions in expressions and I’ll also cover common mistakes when it comes to writing expressions and show you a few tips and tricks along the way.
As a beginner or even an intermediate flow builder—expressions can seem a bit complex at first, I’m going to try to simplify it for you. If you want to level up your flows by writing expressions—keep watching!
IN THIS VIDEO:
✅ What is an Expression?
✅ What is a Function?
✅ What Does Wrapping a Function Mean?
✅ How Do I Insert an Expression?
✅ How to Use a Compose action
✅ How to Navigate the Expression Builder with Arrow Keys
✅ How to use the Expression Tooltip
✅ Common Mistakes When Writing Expressions
✅ How to differentiate a null from an empty string
✅ How to Get Dynamic Content When it’s Not Listed
✅ How to Use a Get Item Action to Verify Dynamic Content Output
✅ How to Convert Strings to Lower Case
✅ How to Troubleshoot the if() Function
Hope this helps!