Showing results for 
Search instead for 
Did you mean: 
Frequent Visitor

powerapps forall

I am using the SharePoint List as a database with a title DateStart. When a user enter a number to represent a number of days (eg: 3), I would like to create 3 date records with a starting date based on today. (DateStart (dd/mm/yyyy) should be 6/12/2020, 7/12/2020, 8/2/2020. I have try to the ForAll function and Patch function, and managed to create the datestart 3x times but with the same date 6/12/2020. How do you use the increment in the ForAll loop so the date increase? 



No worries, happy to help.


Yes, this is doable, it just becomes a little math problem - with some added on screen logic. The logic I would use is make users pick a certain day of the week to make the math easier eg Monday (you can pick Sunday or another day if you like but I'll work on Monday here).


So, user selects a Monday and the record inside your Patch gets updated to:

Patch(ABC, Defaults(ABC),
// add a Monday record
{RecurrenceDateDaily: DateAdd(DateValue3.SelectedDate, ((Value-1) * 7), Days)},

// add a Thursday record
{RecurrenceDateDaily: DateAdd(DateValue3.SelectedDate, ((Value-1)*7) + 3, Days)}


You can use the same ForAll() structure and same counter you setup before.


To check if a user has picked a Monday, put this is a label somewhere (oh, and also Disable/Enable your Save button depending on if a Monday has been chosen or not):

    "Please chosen a Monday date. You cannot Save your data",
    "Your data is ready to Save")

Note: Weekday() returns a number from 1-7, Sunday=1 ,  Monday=2 ...




View solution in original post

Frequent Visitor

many thanks for your advice and much appreciated.

How would I go about creating a collection weeks?

Would it be similiar to the collection for DateRange - Date, Day, value but instead WeekRange - Date, Week, value? (where Week is Mon, Tues,......etc?

Your help would be much appreciated.

@SimonDu88 I'm a little unsure of what you are wanting to do here. Could you provide an example?


If it's just a Week vs a Date range, yes you should be able to do it you have set-out. What have you tried?

Helpful resources

PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group


Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Don't miss the call this month on June 16th - 8a PDT

Top Solution Authors
Top Kudoed Authors
Users online (61,776)