Hi All,
I have a very specific requirement that is related to creation of records in a SharePoint list.
Requirement
The form would allow the user to select a start date and an end date. Now the user will also have an option to select Days of Week. For Example: Monday, Tuesday , Wednesday and so on.
Now if the user selects a date range from 01/11/2021 - 07/11/2021 and selects the days as Monday , Wednesday and Friday. Then, the system should create 3 identical records only for those dates which fall on these days as selected by user.
i hope i am making sense. How can this be done in PowerApps?
Any help would be appreciated.
Thanks in advance!
Solved! Go to Solution.
Hi @Jayant_2203 ,
I felt like a challenge on this one so please look at this carefully as it works in my model
Date Pickers are dpStart and dpEnd
Combo Box is cbDays with Multiple Selection and the Items
[
"Mon",
"Tue",
"Wed",
"Thu",
"Fri",
"Sat",
"Sun"
]
Button OnSelect
Clear(colDays);
With(
{
wStart: dpStart.SelectedDate,
wEnd: dpEnd.SelectedDate
},
ForAll(
Sequence(
DateDiff(
wStart,
wEnd,
Days
) + 1
),
With(
{
wDay:
DateAdd(
wStart,
Value - 1,
Days
)
},
If(
Text(
wDay,
"ddd"
) in cbDays.SelectedItems,
Collect(
colDays,
{WeekDay: wDay}
)
)
)
)
)
The gallery is simply Items
colDays
and the label Text
Text(ThisItem.WeekDay,"dddd, d mmmm yyyy")
Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.
Visit my blog Practical Power Apps
What exactly do you mean by that? What will the records contain and where are you getting the data from for the identical records. You would only have to add the fields here (also do not use Date as a field name)
Collect(
colDays,
{
DateValue: wDay,
Title:"YourTitleValue",
OtherField:"YourOtherValue"
}
)
Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.
Visit my blog Practical Power Apps
Hi @Jayant_2203
Have a look this post https://powerusers.microsoft.com/t5/Building-Power-Apps/Splitting-date-range-to-different-Sharepoint...
Hi @Jayant_2203 ,
I felt like a challenge on this one so please look at this carefully as it works in my model
Date Pickers are dpStart and dpEnd
Combo Box is cbDays with Multiple Selection and the Items
[
"Mon",
"Tue",
"Wed",
"Thu",
"Fri",
"Sat",
"Sun"
]
Button OnSelect
Clear(colDays);
With(
{
wStart: dpStart.SelectedDate,
wEnd: dpEnd.SelectedDate
},
ForAll(
Sequence(
DateDiff(
wStart,
wEnd,
Days
) + 1
),
With(
{
wDay:
DateAdd(
wStart,
Value - 1,
Days
)
},
If(
Text(
wDay,
"ddd"
) in cbDays.SelectedItems,
Collect(
colDays,
{WeekDay: wDay}
)
)
)
)
)
The gallery is simply Items
colDays
and the label Text
Text(ThisItem.WeekDay,"dddd, d mmmm yyyy")
Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.
Visit my blog Practical Power Apps
@Ramole Thanks for the reference. I wanted to create SharePoint records for date range for selected days.
@WarrenBelz thank you for the answer.
However, i would want to create SharePoint records for Tuesday , Thursday and Sunday. between the selected date range.
How can i do so?
SharePoint List item can be basic details like Title , Date , etc..
What exactly do you mean by that? What will the records contain and where are you getting the data from for the identical records. You would only have to add the fields here (also do not use Date as a field name)
Collect(
colDays,
{
DateValue: wDay,
Title:"YourTitleValue",
OtherField:"YourOtherValue"
}
)
Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.
Visit my blog Practical Power Apps
User | Count |
---|---|
159 | |
85 | |
68 | |
63 | |
61 |
User | Count |
---|---|
209 | |
151 | |
93 | |
81 | |
69 |