Pick item from array based on prefix

Hello everyone!

This is my first post ever, and I am excited to dig deep into make.com! While I do have some experience in software development and thus am totally okay with functions, modules, etc. - I sometimes struggle to do something “the Make way”. Looking for some advice on that. Thank you!

I am creating a scenario that deals with incoming physical mail. In short:

Trigger: A new envelope is scanned and arrives in the GMail inbox. It will get two labels: Automation/Scanned Mail and Location/xy (multiple locations possible, only one per mail). Example:

Result of the scenario: The recipient of the mail gets notified (currently email, probably moving to slack eventually) that there is mail for them to be picked up, including the image. Not there yet but that might be another post here.

What I am stuck with:
The first module is "GMail - Watch Emails. After getting triggered, I’d like to get the label with prefix “Location/” from the labels[] array and save the second half (“xy”) in a variable.

Input:

Expected Result:
Variable containing “Thao Dien”

In Python I would start with

for item in array if item.startswith("Location/")

to find the item and then take it from there (array → string → split → 2nd item), probably using lambda. But with make? Not sure.

I have asked multiple AIs and they weren’t exactly helpful. ChatGPT suggested functions that do not exist. Make AI only added another module, stating “here is where your implementation could be”, and Gemini gave me JS for a custom JS module (not available in my plan).

So now I am counting on the wisdom of real humans :wink:

Thank you!

Alex

1 Like

Ah, I figured it out! Well, I didn’t, someone else did:

2 Likes

Hi @AlexanderJ

Glad to know you issue is solved.

Best regards,
Msquare Automation
Platinum Partner of Make
@Msquare_Automation

2 Likes