Evaluate Attachment for Presence of Data

Hopefully this is an easy one for you guys - but I can’t figure it out.

My scenarios retrieves an attached CSV file from an Outlook message. That part works fine. But in some cases, the attached file only contains a single header row with no data.

When my scenario encounters this, it ends successfully and doesn’t throw an error. I need to continue the scenario a few more modules to finish the scenario which includes categorizing the original email to indicate it has been processed.

How do I force the scenario to continue if it isn’t generating an error?

Thank you!

Hi @Scott_Snyder

The ideal way is to split the scenario into two routes - The first one will process the CSV, get results, and store the status in a Set Variable module.

Then, get the output in the other route using the Get Variable module.

MSquare Support
Visit us here
Youtube Channel

2 Likes

Wow - thank you for the quick reply!!!

I actually tried to use the router module, but I put it behind the “Parse CSV” module. See below.

Do I need to put that before the Parse module? I was trying to use a filter to test for data in the attachment.

No, put a “Text parser: Match pattern” module before a router.

For Pattern, put \n in there. This matches a newline so you know there is more than just the header row in the data. Important: Select “Continue the execution of the route even if the module finds no matches”.

For filters, output “Value” or “Fallback Match” of “Text parser: Match pattern” module exists.

Fallback route if no newline found:

@samliew - that’s some awesomeness there! Will run with this - thx!!

Thanks again for the direction last night! I was able to take your suggestion and adapt it. The plan I am on doesn’t let me use variables, so I have to duplicate modules on the two routes, which I don’t like, but it seems to work. The route taken when there is no data in the attachment concludes with updating the source email by assigning a category.

The route taken if there is data in the attachment includes parsing the CSV file which then either updates a record if found in the destination table, or if no record found to update, creates a record in the destination table for each line in the attached file - which is great.

My problem is I only want to update the original email once to indicate it has been processed. However, as it is, my scenario is updating my original email every time a record is updated or created.

How do I get the scenario to just update the email once?
Also, do I need the “Commit” module on the route taken if there is no data in the attachment?

Thanks for the help - I have looked at the documentation, but it seems there is a huge amount of capability that is not documented so this community is extremely helpful to me. thx!

I don’t understand. Do you mean you don’t see variables modules at the bottom here? The “Tools: Set variable” module is just a placeholder I used to demonstrate the fallback route for my screenshot.

In your screenshot, it looks like either routes from the router has an “Update a Message” module, so in any case Email will get updated. If you don’t want to update email on the fallback route, just delete the bottom path (you can keep the router).

You don’t need a commit module, that’s for error handling.

2 Likes

Hey Sam,

It seems like I don’t have access to custom variables on the make.com plan I am currently subscribed to. I’m on the lowest level plan - unless I am missing something. See below:

Regarding your use of a variable: are you saying that the approach you modeled to provide an explanation to me doesn’t require a variable?

Regarding multiple updates to my original email, see image below. I ran my scenario against an email I knew had an attachment with 2 records (serial numbers) In this case my scenario correctly created the 2 records in my table because it could not find a match for the records in the table, but note the output bubbles. You can see that my “U email Category” module ran twice. It runs for each bundle processed, but I only need it to run once.

How do I set that up? I tried to use an aggregator, but I must not have set up correctly because it didn’t solve this issue.

Thanks to all for your help - it means so much!
Cheers,
Scott

Hi Scott, variables are used everywhere, and you can use the Set and Get variable modules.

Variables looks like those pill/badge-like things you click on to insert into fields to map their values into them.

https://www.make.com/en/help/tools/tools#set-variable

What you are referring to, another type of variables : “Custom Variables” are organisation or team-wide variables that can be used in any scenario, which are available on a higher paid plan.

2 Likes

Thanks @samliew, I had explored variables, but after setting a variable, I attempted to use the variable in a subsequent module, but didn’t see it to select it. I’m obviously doing something wrong when setting it although it appears simple enough, so I’m disappointed I am not doing it right.

Regarding the multiple bundles triggering multiple executions of a subsequent module: what technique can I use to drop down to a single execution, Ideally following the last successful record updated or written in my downloaded attachment?

thx!!!

Nevermind - I figured out a solution. It may be obvious to others, but I simply utilized a router and specified that the first route should be completed before finally updating the source email.

Hope this helps someone. I wish it was easier to find information on how to use make. It is clearly powerful, but the biggest hurdle in adopting it is the effort required to find information that describes how to use it.

Thx @samliew for your assistance!

Hi @Scott_Snyder :wave:,
Congratulations on solving this puzzle with @samliew’s help! :jigsaw:

Thanks a lot for remembering to share your insights with us and marking them as a solution. This way our community stays tidy, neat, and easy to look for solutions. :broom:

Keep up the great work!