cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Moreshwar
Resolver I
Resolver I

Issue with ForAll in Gallery

Hello Team,

 

I have built a PowerApp and using Gallery I am allowing users to add/edit data and save it back to SharePoint list. The app works fine for most of the time, however intermittently it sets values of number columns in SharePoint list to 0 for few list items. The issue is very sporadic and difficult to reproduce. I have even tried copying the data from Gallery to a collection and then patching collection back to SP list, however after debugging found that the Gallery itself doesn't let copy over all the data to Collection. 

 

Any help would be greatly appreciated!!

 

Below is the code and screenshots for reference :

ForAll(TimesheetGallery_3.AllItems, Collect(_tempTimesheet, {ID: Value(lblID_1.Text), Title:_timesheetID, ProjectName:ddlNom3.Selected.Result, Manager:_approvalManager, Level2Manager:_level2ApprovalManager, WP:Value(txtWP_1.Text), Email:_employeeEmail, IsHeader:false, ATA:lblATTA_3.Text, Description:txtDesc_3.Text, Jan:Value(txtJan_3.Text), Feb:Value(txtFeb_3.Text), Mar:Value(txtMar_3.Text), Apr:Value(txtApr_3.Text), May:Value(txtMay_3.Text), Jun:Value(txtJun_3.Text), Jul:Value(txtJul_3.Text), Aug:Value(txtAug_3.Text), Sep:Value(txtSep_3.Text), Oct:Value(txtOct_3.Text), Nov:Value(txtNov_3.Text), Dec:Value(txtDec_3.Text), ProjectCIR:ddlCIR_3.Selected.Result, LogicalWP:ddlWP_3.Selected.Value, Year:_currentYear}));

ForAll(_tempTimesheet, Patch(UserTimesheet, If(IsBlank(LookUp(UserTimesheet As temp, temp.ID=ID)),Defaults(UserTimesheet),LookUp(UserTimesheet As temp, temp.ID=ID)),{Title:Title, ProjectName:ProjectName, Manager:Manager, Level2Manager:Level2Manager, WP:WP, Email:Email, IsHeader:IsHeader, ATA:ATA, Description:Description, Jan:Jan, Feb:Feb, Mar:Mar, Apr:Apr, May:May, Jun:Jun, Jul:Jul, Aug:Aug, Sep:Sep, Oct:Oct, Nov:Nov, Dec:Dec, ProjectCIR:ProjectCIR, LogicalWP:LogicalWP, Year:{Value:Year}}));

 

Regards,

Moreshwar
ForAll(_tempTimesheet, Patch(UserTimesheet, If(IsBlank(LookUp(UserTimesheet As temp, temp.ID=ID)),Defaults(UserTimesheet),LookUp(UserTimesheet As temp, temp.ID=ID)),{Title:Title, ProjectName:ProjectName, Manager:Manager, Level2Manager:Level2Manager, WP:WP, Email:Email, IsHeader:IsHeader, ATA:ATA, Description:Description, Jan:Jan, Feb:Feb, Mar:Mar, Apr:Apr, May:May, Jun:Jun, Jul:Jul, Aug:Aug, Sep:Sep, Oct:Oct, Nov:Nov, Dec:Dec, ProjectCIR:ProjectCIR, LogicalWP:LogicalWP, Year:{Value:Year}}));

 

Actual Gallery in AppActual Gallery in AppSharePoint list item version HistorySharePoint list item version HistoryCollection data for debuggingCollection data for debugging

1 ACCEPTED SOLUTION

Accepted Solutions

Found the root cause. It is a bug with Gallery, if the Gallery has large number of items with scroll then column values for items at end of the table/datasource are not returned when you do a ForAll. However, if you scroll through the complete Gallery and then try ForAll, then all items data is available and gets Patched/Saved properly to collection/List. 

View solution in original post

3 REPLIES 3
zmorek
Power Participant
Power Participant

I bet it's the Value(textinputfield.Text) that produces the 0 if the text field has nothing in it - try removing that and testing

The issue is there is no change in data for those row, but still the columns value is 0. Also if I try just Patch to Collection several times without changing data, then also in some cases ForALL sets some row values to 0.

Found the root cause. It is a bug with Gallery, if the Gallery has large number of items with scroll then column values for items at end of the table/datasource are not returned when you do a ForAll. However, if you scroll through the complete Gallery and then try ForAll, then all items data is available and gets Patched/Saved properly to collection/List. 

View solution in original post

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

PowerPlatform 768x460.png

Microsoft Learn

Check out our new Discover Your Career Path blog post series and get all the details.

Users online (1,383)