the above query will filter for emails received from yesterday midnight instead of (-1) in here DateTime.Today.AddDays(-1) I would like to use a variable which where I am storing a user input (nDays).
Basically in my logic the automation has to display a prompt and ask the user for number of days that he want to filter for once that is done I am getting that input and using it in the filter.
I’ve tried this way DateTime.Today.AddDays(Saved.Values(Of UiPath.Excel.ExcelValue)(“nDays”)) and I there wasn’t any error however it’s not working expected.
I would appreciate any help or hint on how to approach the case. Thank you in advance.
Thank you for getting in touch. Obviously when I will use 2 we won’t have output since the date will be in future However for -2 I am getting the list of emails that I have for the last two days.
The main issue here what do I have to use to read the value stored in my variable nDays since the bot is behaving in the right way when I specify the number of days manually into the expression like this “[Received] >= '” + DateTime.Today.AddDays(-1).ToString(“d”) + " 00:00AM’ AND [Received] < ‘“+ DateTime.Today.ToString(“d”) + " 00:00AM’”
However it’s returning the wrong result when I use saved values Saved.Values(Of UiPath.Excel.ExcelValue)(“nDays”) instead of -1.
I have many doubts what is the data type of the output for the input activity ? because as far as I understood it’s string maybe I do have to convert it to type int before using it in my expression ?
Can you check content of Saved.Values(Of UiPath.Excel.ExcelValue)(“nDays”) using WriteLine activity or MessageBox activity (Please put it just befire GetOutlookMailMessage)
I added before and after the get mails and I believe the issue is that the the minus sign in the expression does not affect I would like to invers the number or multiply it by minus one before using it in the get mails activity