Hello,
I built a Power App that helps track and schedule hours needed for a project manager to complete a project. Currently, the submit button takes entries from a nested gallery and patches them into Dataverse tables. It was running perfectly for quite some time, but now it has run into issues where it stops working. I hoping to get help with this issue. Below, I have listed the circumstances where the button stops working and does not allow a user to submit their entries:
- Only the first entry has been placed, and the submit button is clicked (see attached image).
- Adding one entry, not clicking out of the entry box and then clicking submit
- hanging the first entry to 0 and clicking the submit button if no new data has been entered in the gallery.
- Clicking the submit button if no new data has been entered in the to gallery
//Submit Button
//Turn on load spinner
Set(VarPopup, true);
// Clear collection for new entries
Clear(colEntryHours);
//Collect new entries from gallery and nested gallery
ForAll(
EntryGal.AllItems As NewEntry,
ForAll(
NewEntry.WeekAndInputGallery.AllItems As NestedEntry,
Collect(
colEntryHours,
{
cr65f_projectid: Project_Gallery.Selected.ProjectID,
cr65f_projectidManager: Project_Gallery.Selected.ProjectManager,
cr65f_Task: NewEntry.TaskName.Text,
cr65f_DateSubmitted: NestedEntry.StartofWeekGalleryDate.Text,
cr65f_Entry: NestedEntry.HoursInput.Text
}
)
)
);
//Update or replace vaules in Capacity Hours table with entries from collection
ForAll(
colEntryHours,
If(
!IsBlank(cr65f_Entry),
Patch(
Capacity_Hours,
If(
IsBlank(
First(
Filter(
Capacity_Hours,
ProjectID = cr65f_projectid && DateSubmitted = cr65f_DateSubmitted && Task = cr65f_Task
)
)
),
Defaults(Capacity_Hours),
First(
Filter(
Capacity_Hours,
ProjectID = cr65f_projectid && DateSubmitted = cr65f_DateSubmitted && Task = cr65f_Task
)
)
),
{
ProjectID: cr65f_projectid,
ProjectManager: cr65f_projectidManager,
Task: cr65f_Task,
DateSubmitted: cr65f_DateSubmitted,
Entry: cr65f_Entry
}
)
)
);
Reset(LoadColTimer);
Set(StartTimer, true);
Set(
VarEntryTotal,
Sum(
Filter(
FilteredCollection,
DateValue(cr65f_datesubmitted) >= DateAdd(
Today(),
0 - Weekday(Today(), StartOfWeek.Sunday)
)
),
If(IsBlank(cr65f_entry) Or Not(IsNumeric(cr65f_entry)), 0, Value(cr65f_entry))
)
);
LoadColTimer.AutoStart = StartTimer;
Set(VarPopup, false);
_______________________________________________________________________________________________________
//OnTimerEnd separate from button
Clear(colEntryErrorTrack);
// Clear the collection first
ForAll(
EntryGal.AllItems As NewEntry,
ForAll(
NewEntry.WeekAndInputGallery.AllItems As NestedEntry,
Collect(
colEntryErrorTrack,
{
Project: Project_Gallery.Selected.ProjectID,
ProjectManager: Project_Gallery.Selected.ProjectManager,
Task: NewEntry.TaskName.Text,
DateSubmitted: (NestedEntry.StartofWeekGalleryDate.Text),
Entry: NestedEntry.HoursInput.Text
}
)
)
);
Clear(colEntryHours);
Set(StartTimer, false);
//Need to create a collection of the Entered Capacity Hours for each task so that it can be used in calculations
ClearCollect(
FilteredCollection,
ShowColumns(
Filter(
Capacity_Hours,
ProjectID = Project_Gallery.Selected.ProjectID
),
ProjectID,
Task,
Entry,
DateSubmitted
)
);