Separate period by day

Hello everyone,
I am having trouble finding a solution to separate periods.
Well, I have a start date and an end date provided in an excel spreadsheet. Example (dd / mm / yyyy) 01/10/2018 - 31/12/2018. On the website I need to consult, I must enter the start date 01/10/2018 and the end date 1/10/2018 (do what you need and return) enter the start date 2/10/2018 and end date 02/10/ 2018 … do this until the final date informed in the spreadsheet which is 31/12/2018. Can someone help me with an idea

Hi,

You can work with two variables. A start date and an end date.
Using the “AddDays” function you make a repeat loop that increments your start date until it reaches your end date.

hi,

thank you, I put the two variables, initial and final
it would then be

datainicial.AddDays

do while dataincial < datafinal

would the logic be correct?

1 Like

Hi,
Exactly.
Within the while you put all the activities you need to do. Just don’t forget to increment the start date with AddDays at the end of the while, so that it can repeat the structure with the new date.

Hello, I did it as mentioned and it looks like it will work, but I have a problem … My variable is a string and I can’t find the correct syntax to use AddDays, I tried DateTime.ParseExact but it wasn’t. How could I use the syntax

I tried to convert the variable to datetime but then I have a problem passing the argument saying it does not allow implicit string conversions to date

image

Hi,
Write here an example of the content of your variable.
I’m from Brazil and we can have a different date format.

But you can test this out and see if it works for you.

DataTexto = "12/11/2020"
Date.ParseExact(DataTexto, "dd/MM/yyyy", System.Globalization.DateTimeFormatInfo.InvariantInfo)

it reads a column in excel with the date in Brazil format even dd / mm / yyyy
then we have in the variable string 01/10/2019

I converted the variable using the DateTime.ParseExact so far so good

image

but when trying to use AddDay I can’t find any correct syntax to use it with the variable string

I tried to change to datetime, but when I call the flow and pass the argument
in_TransactionItem.Item (“Initial Data”). ToString it doesn’t work