I am trying to do a simple logic in make but I am new and can’t figure it out with the documentation.
I want to scan email attachments. If there is a file with a file name containing a certain string, I want to set a variable. That will later help me decide which file to process.
I have tried to use array functions in a “setVariable” Module: {{first(map(1.attachments; “fileName”; “fileName”; “”“Request_Assenbly”“”))}}
If you want your scenario to continue only when there’s an attachment with the exact file name like “image001.jpg”, you can just add a filter to check for that specific name as follows.
But if you’re trying to check whether any of the attachments contain something like “Image” in the file name, then you’ll need to use an iterator to go through each attachment, add a filter to check if the name contains that word, and then use something like an aggregator to collect the matching files. That way you can handle partial matches instead of just exact ones.
To give a bit more context: I process emails with various PDF attachments. If one contains a “Request_Assembly” file, I want to process that. If it contains a “Request_Disassembly”, then that one. If both are present, I want to process only the “Request_Assembly”.
The filenames are longer, but always contain that string.
That’s why I first want to find out whether a “Request_Assembly” is present, and then use that variable later in a filter.
Glad to know that your issue is resolved now.We would really appreciate if you mark the answer as solution if it helped you. This will keep the community healthy and organized.