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

Weird interaction between PowerApps and SharePoint

Hello!

(Problem after both codes, this first paragraphs are just for context)

 

So lately I've been developing an app that allows one person to Add a value to a certain item's quantity and another person to Subtract from that same item's quantity, both determined by the value of a slider.

 

So this interaction was working perfectly, but when I tried using two devices at the same time, one in the add screen and the other on the subtract screen. The first one to click the button that patches the SharePoint List was able to do so, whilst the other got an ETAG mismatch error.

 

To try and fix this I made a post here with the problem and got a solution. To change from a Patch() to a UpdateIf() and it worked, got rid of the ETAG mismatch error. But brought me a new one even weirder.

 

So here is the deal, I've got my PowerApps app linked to a SharePoint list with about 15 items with just 2 columns. The items name (Title) and the items quantity (Qtd.). The code for both the Add and the Subtract buttons are as follows:

 

 

Add

Refresh(Ferramentas);;
If(
    Slider2_1.Value > 0;
    UpdateIf(                                  /* This was the solution to the ETAG mismatch /*
        Ferramentas;
        ThisItem.'Qtd.' >= 0;                  /* This was required to make the UpdateIf() work /*
        {'Qtd.': Value(ThisItem.'Qtd.') + Slider2_1.Value}
    )
);;
If(
    Slider2_1.Value > 0;
    Navigate(
        TelaÊxito;
        ScreenTransition.Cover
    )
)

Subtract

Refresh(Ferramentas);;
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(Slider2);;
Reset(Gallery2)

P.S.: I added sucessful and error screens in both buttons

 

 

Finally after all this blabering I will get to the point I'm having trouble.

Here is the problem:

1- I set manually all sharepoint values to Number W;

 

2- I click the Subtract button with the Slider set at a certain value, Number W gets subtracted by Slider2.Value on that specific item, displaying now Number X (Number W - Slider2.Value);

 

3- I now click the Add button with the Slider set again at a certain value, but now, EVERY item in my SP list gets its Qtd. set to Number W + Slider2_1.Value instead of that specific item changing to Number X + Slider2_1.Value. Lets call this new number Number Y;

 

4- I once again click the Subtract button with the Slider at a certain value, but now, instead of taking Number Y and subtracting the Slider2.Value on that specific item, it subtracts from Number X;

 

5- Repeat steps 3 and 4 indefinetly always getting higher;

 

This keeps happening until I close PowerApps and change SharePoint's values manually. After which it starts again if I use the app.

 

Anyone got any insight of what this might be?

Helpful resources

Announcements
firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

SecondImage

Follow PowerApps on Twitter

Stay Up-to-Date by following PowerApps on Twitter

Top Community Contributors for July 2019

Top Community Contributors for July 2019

Let's thank our top community contributors

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

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

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

FifthImage

Dynamics 365 and Power Platform April 2019 Release notes

Features releasing from April 2019 through September 2019!

Users Online
Currently online: 38 members 4,097 guests
Please welcome our newest community members: