In this video I showcase my Power Apps Timesheet Template which lets you submit and keep track of weekly timesheets.
In this video you'll learn about:
✅ Repeating Tables in Power Apps
✅ ForAll()
✅ How to Patch new and existing records
✅ Working with Collections
The Power Apps Template and Flow to provision the list can be found here: https://github.com/aprildunnam/PowerApps/tree/master/Timesheet
watch?v=A8SiNTnQw0Q
Hi @aprildunnam
Thank you so so much for this amazing tool. I have learnt a lot from this and in particular it is exactly what I needed for a timetabling application I am creating.
You can see here in the screenshot how I am using your concept. I am using a Sharepoint calendar/List as my data source:
The initial challenge I faced was to be able to add multiple lessons for the same course, and using the patch function I am able to.
in a previous screen i have an Add button:
ClearCollect(timeEntriesCollection,
{
LessonNo: 1,
Attendees:"",
Course: "",
Category: "",
Location: "",
'Start Time': Now(),
'End Time': Now()
});
Navigate(AddEvent,ScreenTransition.None);
On the Add Event Screen, the + button:
Select(Parent);
Patch(
timeEntriesCollection,
ThisItem,
{
LessonNo: Value(lblLessonNo.Text),
'Start Time': StartDatePicker.SelectedDate + Time(Value(ddStartHour.Selected.Value), Value(ddStartMinutes.Selected.Value),0),
'End Time': EndDatePicker.SelectedDate + Time(Value(ddEndHour.Selected.Value), Value(ddEndMinutes.Selected.Value),0)
}
);
Collect(
timeEntriesCollection,
{
LessonNo: lblLessonNo + 1,
'Start Time': DateAdd(StartDatePicker.SelectedDate,7,Days) + Time(Value(ddStartHour.Selected.Value), Value(ddStartMinutes.Selected.Value),0),
'End Time':DateAdd(EndDatePicker.SelectedDate,7,Days) + Time(Value(ddEndHour.Selected.Value), Value(ddEndMinutes.Selected.Value),0)
}
)
And the Save button:
ForAll(
galleryClassAdd.AllItems,
Patch(
'Timetable Test',
Defaults('Timetable Test'),
{
Course: toptxtCourse.Text,
Location: toptxtLocation.Text,
'Start Time': If(Checkbox1.Value=false, StartDatePicker.SelectedDate + Time(Value(ddStartHour.Selected.Value), Value(ddStartMinutes.Selected.Value),0), StartDatePicker.SelectedDate + Time(0,0,0)),
'End Time': If(Checkbox1.Value=false, EndDatePicker.SelectedDate + Time(Value(ddEndHour.Selected.Value), Value(ddEndMinutes.Selected.Value),0), EndDatePicker.SelectedDate + Time(23,59,59)),
Attendees: TeacherSelector.Selected,
Category: CategorySelector.Selected,
LessonNo: If(Not(CategorySelector.Selected.Value="Weekend"),"Session - " & lblLessonNo.Text)
}
)
);
Refresh('Timetable Test');
Reset(TeacherSelector); Reset(toptxtCourse); Reset(CategorySelector); Reset(toptxtLocation);
Set(successMessage,"Event added successfully");Navigate(SuccessScreen)
Adding the event works wonders, however I am unable to make the editing of a selected item work.
The formula in the edit screen does not accept the same Collect codes:
Any ideas what I might be doing wrong here?
Your input will be greatly appreciated. I love your videos as I learn a lot.
Thanks,
Mo
Hi @aprildunnam ,
I've sent you a PM with a link to video which probably would be easier to see the codes.
However, the errors as soon as I add the Collect formulas gives me this:
And then everything else breaks.
Hi @aprildunnam , I was wondering if you've had a chance to look at my errors. Thank you.
Hi @aprildunnam ,
This is something i was looking for a long time. Thank you very much.
When i tried to import "TimesheetProvisioner_20200721042207.zip", I'm getting following error,
"The solution file is invalid. The compressed file must contain the following files at its root: solution.xml, customizations.xml, and [Content_Types].xml. Customization files exported from previous versions of Microsoft Dynamics 365 are not supported."
can you please help me with this,
Regards,
Sanjay
Hi April,
Wow! I am looking to implement this in my company but we do not use SharePoint. Is that an issue? Do you have an excel template?
Thank you,
Skye
Hello @aprildunnam ,
Thank you so much for creating this template. It's helped me (a complete newcomer to Power Apps) tremendously with an immediate requirement. I'm having an issue wherein the weeks in the ddWeeks control are suddenly no longer starting on the current Monday as they were previously:
AddColumns(
weeksList,
"WeekEnd",
DateAdd(
Value,
6,
Days
),
"Week Display",
Value & " to " & DateAdd(
Value,
6,
Days
)
)
I haven't made any changes to the code on this control. Any ideas?
Additionally, I added a few new fields and I'm having an issue wherein the selection in a new drop-down field is not saved when multiple entries are saved at once.
Here's me saving them:
Here's how they appear in My Timesheets after saving:
The value in the drop-down on the first option is seemingly lost. Any idea what could be driving that?
Hi @AbleAmazing I am having exact the same problem. Have you figured out any solution for that? If yes, could you please share?
Thanks