Change report dates

Hello everyone,
Can you please assist me with this flow

I have that report coming in everyday with real time date for each and everyday.
When I am running my bot it filters the attached file for a current date, it cannot filter for maybe a date from yesterday.
Here are my assign dates:

I want the bot to be able to run even for previous day.

1 Like


Now.Adddays(-1) will give you previous date…remaining everything you have done already


Where do I put it in A seperate assign?


Yes please this will give the previous day and remaining wverything can be done from this variable you assigned just like todaydate variable


1 Like

Hi @Anelisa_Bolosha

Keep the Assign activity under the TodaysDate assign activity and give below condition:


Hope it helps!!

1 Like

Hi @Anelisa_Bolosha

If you find solution for your query mark it as solution to close the thread.

Happy Automation. :slight_smile:

To filter email attachments with names containing the current date and the previous date in UiPath, you can use the “Get Outlook Mail Messages” activity to retrieve emails with attachments and then use string manipulation and DateTime functions to filter the attachments based on their names.

Here’s a step-by-step guide on how to achieve this:

  1. Use “Get Outlook Mail Messages” Activity:
    Drag and drop the “Get Outlook Mail Messages” activity into your UiPath workflow. Set the necessary properties like the account, mailbox, filters, and other options to retrieve the emails with attachments.

  2. Loop Through Email Messages:
    Use a “For Each” loop to iterate through each email message obtained from the “Get Outlook Mail Messages” activity.

  3. Extract Attachment Names:
    Within the loop, use the “Save Attachments” activity to save the attachments to a specified folder on your system. This will also provide you with the attachment names.

  4. Filter Attachments Based on Dates:
    Implement string manipulation and DateTime functions to filter the attachments based on their names containing the current date and the previous date. You can use the DateTime.Now function to get the current date and then use DateTime.AddDays(-1) to get the previous date.

    For example, to check if the attachment name contains the current date (in the format “yyyyMMdd”) or the previous date, you can use something like this:

currentDate = DateTime.Now.ToString("yyyyMMdd")
previousDate = DateTime.Now.AddDays(-1).ToString("yyyyMMdd")

For Each attachmentName In attachmentNames
    If attachmentName.Contains(currentDate) Or attachmentName.Contains(previousDate) Then
        ' Process the attachment or save it to another folder
    End If

Note: attachmentNames should be an array or list containing the names of the attachments retrieved from the “Save Attachments” activity.

  1. Perform Actions on Filtered Attachments:
    Inside the loop, perform the desired actions on the filtered attachments, such as saving them to a specific folder, processing their content, or any other required operations.