cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
jenlynn1470
Level: Powered On

UpdateIf not pushing update to records in Collection

Hi All,

 

I am not sure why but yesterday my app was working but today something is not working for my UpdateIf function.

 

I have a gallery that lets a users to enter info for several records into a collection.  Then I have several fields that the rep fills out using a button it updates the gallery using the UpdateIf function on the main collection. 

 

Everything seemed fine yesterday when I published. I changed one variable to disable a button but I didn't change anything regarding the datasource or the collections.   I tried removing the Patch function to debug but I cannot see where the UpdateIf syntax is incorrect and not working. But those fields are not updated my collection using UpdateIf.

 

Could there have been a powerapps Update that might be causing something to break in my app? 

 

I tried to restore the app to a previous working point but that didn't solve anything. 

UpdateIf(
VisitCollection,
true,
{
Request_x0020_Type: RequestTypeSelect_1.Selected.Value,
Rep_x0020_Name: RepNameText2.Text,
Rep_x0020_ID: RepIDText2.Text,
Ship_x0020_To_x0020_Direction: ShipDirection_1.Selected.Value,
Alternate_x0020_Address: AlternateaddyText2.Text,
Rep_x0020_to_x0020_Get_x0020_Lab: NeedLabel.Text,
Rep_x0020_to_x0020_Get_x0020_Mat: NeedMaterials.Text,
Comments: CommentsText.Text,
NeedbyDate: DatePicker1.SelectedDate,
LabelEmail: LabelEmail2.Text
}
);
ForAll(
VisitCollection,
If(
!IsBlank(h3yg),
Patch(
'Material Request',
Defaults('Material Request'),
{
Request_x0020_Type: Request_x0020_Type,
Rep_x0020_Name: Rep_x0020_Name,
Rep_x0020_ID: Rep_x0020_ID,
Ship_x0020_To_x0020_Direction: Ship_x0020_To_x0020_Direction,
Alternate_x0020_Address: Alternate_x0020_Address,
Rep_x0020_to_x0020_Get_x0020_Lab: Rep_x0020_to_x0020_Get_x0020_Lab,
Rep_x0020_to_x0020_Get_x0020_Mat: Rep_x0020_to_x0020_Get_x0020_Mat,
Comments: Comments,
NeedbyDate: NeedbyDate,
LabelEmail: LabelEmail,
Title: Title,
p8pb: p8pb,
h3yg: h3yg,
Project_x0020_Title: Project_x0020_Title,
Location_x0020_ID: Location_x0020_ID,
ProjectShipDirection: ProjectShipDirection,
EmailTo: EmailTo
}
)
)
);

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: UpdateIf not pushing update to records in Collection

Hi @jenlynn1470 ,

I've made a similar test but not met the sam problem like your description.

Here's my formula:

ClearCollect(a,{id:1},{id:2},{id:3});UpdateIf(a,true,{id:11})

My UpdateIf function works well.826.PNG

Please check your fields' data type. Only if the data type is the same as the value that you want to update with , the formula will work.

You could use Patch to test whether the data type is right.

For example:

Patch(VisitCollection,Defaults(VisitCollection)
{
Request_x0020_Type: RequestTypeSelect_1.Selected.Value,
Rep_x0020_Name: RepNameText2.Text,
Rep_x0020_ID: RepIDText2.Text,
Ship_x0020_To_x0020_Direction: ShipDirection_1.Selected.Value,
Alternate_x0020_Address: AlternateaddyText2.Text,
Rep_x0020_to_x0020_Get_x0020_Lab: NeedLabel.Text,
Rep_x0020_to_x0020_Get_x0020_Mat: NeedMaterials.Text,
Comments: CommentsText.Text,
NeedbyDate: DatePicker1.SelectedDate,
LabelEmail: LabelEmail2.Text
})

If the new record  updates seccessfully, then the data type is right.

 

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
Community Support Team
Community Support Team

Re: UpdateIf not pushing update to records in Collection

Hi @jenlynn1470 ,

I've made a similar test but not met the sam problem like your description.

Here's my formula:

ClearCollect(a,{id:1},{id:2},{id:3});UpdateIf(a,true,{id:11})

My UpdateIf function works well.826.PNG

Please check your fields' data type. Only if the data type is the same as the value that you want to update with , the formula will work.

You could use Patch to test whether the data type is right.

For example:

Patch(VisitCollection,Defaults(VisitCollection)
{
Request_x0020_Type: RequestTypeSelect_1.Selected.Value,
Rep_x0020_Name: RepNameText2.Text,
Rep_x0020_ID: RepIDText2.Text,
Ship_x0020_To_x0020_Direction: ShipDirection_1.Selected.Value,
Alternate_x0020_Address: AlternateaddyText2.Text,
Rep_x0020_to_x0020_Get_x0020_Lab: NeedLabel.Text,
Rep_x0020_to_x0020_Get_x0020_Mat: NeedMaterials.Text,
Comments: CommentsText.Text,
NeedbyDate: DatePicker1.SelectedDate,
LabelEmail: LabelEmail2.Text
})

If the new record  updates seccessfully, then the data type is right.

 

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

jenlynn1470
Level: Powered On

Re: UpdateIf not pushing update to records in Collection

I think that there was something else causing the issue but I couldn't find it. All my fields are text fields so I don't think that was the issue.  I had a copy of the app that I saved replaced my published version and it is now working. Thanks for the help. 

Helpful
Level 8

Re: UpdateIf not pushing update to records in Collection

I'm seeing this same behavior - was working just fine, now it's not.  Unfortunately restoring from a previous version is not an option.

Anyone familiar with known issues on this?  I suspect it has something to do with the new "improved data source experience"

Helpful resources

Announcements
thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Kudoed Authors (Last 30 Days)
Users online (4,324)