cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Server Response ETAG mismatch (Conflicts exist with changes on the server, please reload)

Hello!

 

I'm developing an app that keeps track of an inventory, where one person subtracts from the inventory and the other person adds to it.

 

I've managed to get this to work but whenever the user adds, and soon after the other user subtracts, I get an ETAG mismatch.

 

I Have seen solutions of this and most said about the Refresh(SharePointList) function, I tried it and it didn't work aswell.

 

Can anyone help me?

 

Subtract code

If(
    Slider2.Value > 0 && Value(ThisItem.'Qtd.') > 0;
    Patch(
        Ferramentas;
        ThisItem;
        {'Qtd.': Value(ThisItem.'Qtd.') - Slider2.Value}
    )
);;
If(
    Slider2.Value > 0 && Value(ThisItem.'Qtd.') > 0;
    Navigate(
        TelaÊxito;
        ScreenTransition.Cover
    )
);;
If(
    Slider2.Value > 0 && Value(ThisItem.'Qtd.') <= 0;
    Navigate(
        TelaErro;
        ScreenTransition.Cover
    )
);;
Refresh(Ferramentas);;
Reset(Gallery2)

 

Add code

If(
    Slider2_1.Value > 0;
    Patch(
        Ferramentas;
        ThisItem;
        {'Qtd.': Value(ThisItem.'Qtd.') + Slider2_1.Value}
    )
);;
If(
    Slider2_1.Value > 0;
    Navigate(
        TelaÊxito;
        ScreenTransition.Cover
    )
);;
Refresh(Ferramentas);;
Reset(Slider2)

I Also added the neat detail of getting a sucess or an error screen in case the item they want to subtract has their stock on 0!

 

If anyone can help I would be immensely thankful since I need to present this app next week!

Thank you!

6 REPLIES 6
PhilD
Kudo Kingpin
Kudo Kingpin

Hi. I have improved the reliability of something similar by replacing the variable with a LookUp in the Patch function property that defines specific record to patch. https://powerusers.microsoft.com/t5/General-Discussion/Solution-for-my-ETAG-Mismatch-errors-when-pat... In your case, you may want to try replacing 'ThisItem' with a LookUp to the record you want to patch.
v-xida-msft
Community Support
Community Support

Hi @Anonymous,

Based on the error message that you provided, I think there is something conflict issue with your Subtract code and your Add code.

The user @karl has faced same issue with you, please check the response within the following thread:

https://powerusers.microsoft.com/t5/General-Discussion/Server-Response-ETAG-mismatch-Conflicts-exist-with-changes-on/td-p/131599

 

Please take a try to modify your formula as below:

Subtract code:

Refresh(Ferramentas);;  /* <-- Move Refresh('datasource') formula into here */
If(
    Slider2.Value > 0 && Value(ThisItem.'Qtd.') > 0;
    Patch(
        Ferramentas;
        ThisItem;
        {'Qtd.': Value(ThisItem.'Qtd.') - Slider2.Value}
    )
);;
If(
    Slider2.Value > 0 && Value(ThisItem.'Qtd.') > 0;
    Navigate(
        TelaÊxito;
        ScreenTransition.Cover
    )
);;
If(
    Slider2.Value > 0 && Value(ThisItem.'Qtd.') <= 0;
    Navigate(
        TelaErro;
        ScreenTransition.Cover
    )
);;
Reset(Gallery2)

Add Code:

Refresh(Ferramentas);;  /* <-- Move Refresh('datasource') formula into here */
If(
    Slider2_1.Value > 0;
    UpdateIf(          /* <-- Modify formula here, use UpdateIf function to update your record instead of Patch function */
        Ferramentas;
        ThisItem;
        {'Qtd.': Value(ThisItem.'Qtd.') + Slider2_1.Value}
    )
);;
If(
    Slider2_1.Value > 0;
    Navigate(
        TelaÊxito;
        ScreenTransition.Cover
    )
);;
Reset(Slider2)

Please take a try with above solution within your app, then check if the issue is solved.

 

Best regards,

Kris

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Hello, thank you for the answer, although I'm trying to do it, I get an error message like the following:

 

"Invalid argument type (record). Expecting a boolean instead"

 

Any suggestions on how to fix that?

Thanks!

Anonymous
Not applicable

UPDATE

 

So I've managed to fix the argument issue but now everytime I try to add something to the list with de Add Code, instead of adding the slider value to the 'Qtd.' column of "ThisItem", it sets the 'Qtd.' value of every item to be the same as "ThisItem"

 

Code is as follows:

Refresh(Ferramentas);;
If(
    Slider2_1.Value > 0;
    UpdateIf(
        Ferramentas;
        ThisItem.'Qtd.' >= 0;   /* The fix to the argument error was adding ">=0"  /*
        {'Qtd.': Value(ThisItem.'Qtd.') + Slider2_1.Value}
    )
);;
If(
    Slider2_1.Value > 0;
    Navigate(
        TelaÊxito;
        ScreenTransition.Cover
    )
);;
Reset(Slider2_1)

 

Anonymous
Not applicable

***LATEST UPDATE***

 

Ok, so I tried a couple of things.

 

First things firts, when I entered the code for the add button you provided it hit me with an Invalid Argument error, expecting a boolean. What I did to fix it was the following:

 

Refresh(Ferramentas);;
If(
    Slider2_1.Value > 0;
    UpdateIf(
        Ferramentas;
        ThisItem.'Qtd.' >= 0;   /* The fix to the argument error was adding ">=0"  /*
        {'Qtd.': Value(ThisItem.'Qtd.') + Slider2_1.Value}
    )
);;
If(
    Slider2_1.Value > 0;
    Navigate(
        TelaÊxito;
        ScreenTransition.Cover
    )
);;
Reset(Slider2_1)

 

So after doing this it worked, no ETAG Mismatch, but (and it is a huge but), now, whenever I try to add or subtract anything on my sharepoint list, the following happens:

 

Lets create a hypothetical situation to better illustrate

 

1- I manually set all sharepoint 'Qtd.' values to 10;

2- I click the Subtract button of ThisItem with the Slider2.Value set to 5. It works fine, ThisItem 'Qtd.' value is now 5;

3- I click the Add button of the same ThisItem with the Slider2_1.Value set to 10. Now ALL SharePoint items have their 'Qtd.' set to 20 (Initial 10 + Slider2.Value)

4-Now if I click the Subtract button again, it works fine;

5- Now clicking the Add button again on any item, sets ALL SharePoint values to 20+Slider2_1.Value, regardless of the value the item had;

 

So in sum

 

-I add a value to an item, all SP items get set to the same number (Number X);

-I subtract a value to an item, only that item subtracts to Number X;

-I add a value again to any item, it takes Number X and adds the slider value to all SP items;

-Now all items have Number Y value;

-I subtract again from any item, only given item subtracts from Number X instead of Number Y;

-I add again, all SP items are now Number Y + Value, so lets call it Number Z;

-Subtract again, selected item now subtracts to Number instead of Number Z;

 

...and so on...

 

Anyone ever had this error? It's really making me crack my head, I would appreciate any help!

 

Thanks!

Did you ever get a solution to your problem?

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Don't miss the call this month on June 16th - 8a PDT

Top Solution Authors
Top Kudoed Authors
Users online (86,609)