Need to check if a IEnumerable argument has any value stored and return is as a bool

Hello all, and I wish you all the best.

I am developing a workflow where I run my inbox and try to retrieve an attachment, then I want to check if I have anything in that argument and return it as a boolean so that I can write to a text file (used to log every activity in the workflow) if the file was downloaded successfully or if no file was found and thus attachment retrieval was unsuccessful.

If anyone could help me, it would be greatly appreciated.
Note: I am working with C#.

@goncalo.rocha

In IF condition try as below

Out_Downloaded_Excel_File.Any()

Hope this may help you

Thanks,
Srini

Hello,
Unfortunately, it did not help; it did not write any of the conditions. Thank you anyway for the time you took trying to help.

Hi @goncalo.rocha ,

Could you let us know what was the execution route ? Since we see from the Screenshot that there are no activities present in the Then part, maybe that is the reason there was no log ?

Or Could you let us know where is the Logging done ?

the loggin is to be performed using a append line to a .txt file within the Then\Else, depending on the variable having a value or not ( if it found any attachments within the scanned emails) it writes two diferent messages.

@goncalo.rocha ,

We do not see the Append Line activity within the Then Part of If activity in the Screenshot shared.

Could you maybe provide the Screenshot of the Implementation where it is done ?

please see if this helps:

Thank you.

@goncalo.rocha ,

Thank you for providing the Proper view of the Implementation done.

We do see now that the Append Line is implemented and also in the Else part.

So, now we ask does it move to the Else part and write the Logging message into the text file ?

If the email, does have attachments, then we can further check by performing a Debug after the Save Attachments activity and confirm whether the Email itself was the issue or the If Expression is the issue (should not be the case).

I ran the automation, I manually checked if the attachment had been handled and then went to the .txt file to see if it had been logged but no line had been added to the file, within the first two entries there should be one saying if it was successful or unsuccessful

THank you for all the help.

@goncalo.rocha ,

Just for Checking use a Write Line Activity with some textr, before the If activity, we should be able to figure out If the control has entered the For Each Mail activity. If the Write Line value is visible in the Output Panel, then it has entered the For Each Mail, else there are no mails to be processed.

A better Option would be to Debug / Step Into and check the execution at each step/activity.