Dear all
I managed to solve this by myself. But it took me a long time!
As mentioned I have a start-date and a stop-date. For every single day from start until the stop date I want to do something.
- In the workflow I set a variable with the result of the function "day difference".
- With this value I'm using a "create reference" step and do a "Get List Items" of a smart object of a "helper list" in sharepoint. This list only contains one column with the numbers 1 to 31. For the "Get list items" I am using the "day difference" as a filter (Column number is less than day difference). The output is a list of numbers (starting from 1) until the "day difference". I called this reference "Helper items"
- With this "helper items" list I'm using a loop-step and for each loop of the loop step I do the needed action for one day
et voila: A loop over a date range is ready
Additional Infos:
@function "day difference": I learned that the function "date difference" returns comma-values. If the start and the end-date are on the same date (for example from 10am to 8pm then the return value is 0.4!! So I had to use the "to Integer" functio
@step "loop": If the "day difference" value is 0 than the loop-step is never run and the workflow continues with the next step on the "complete" path of the loop-step. So I had to do one extra step to handle the complete date range because either the first or last day of the date range was allways missing. I decided to do the needed action once before creating the reference and using the loop-step to handle the case "date difference = 0".
Better alternative for the "@step loop" above:
I change my workflow and changed the filter of the "create reference" step. The filter is now:
"column number" < "Formula (Daycounter +1)"
With that filter I don't have the problem anymore that there is not "less than equal" in the filter available.
For the loop action I can now calculate the single dates with this formula:
"start-date" + "column number"
Because the column number starts with 0 we can iterate realy from the start to the end date.