cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Ermin
Frequent Visitor

Issue with live data/when more than one user interacts with the gallery control at the same time

Hey I'm developing a food ordering app at the moment and I have a feature called "Pool" that lists all the pre-ordered menus that have been added by a user who unfortunately can't be in the office that day so someone else can can take over the menu.

 

Info: I have the German syntax running.

 

I have a Gallery control that gets data from a sharepoint list

 

Sort(Filter(
    Pool_1;
    Today() <= 'Angebot Für'
);AddedToPoolDate;Ascending)

 

and for each item in the Gallery control there is also a button with an OnSelect.

 

UpdateContext({BoxVisible3: true});;
UpdateContext({BoxVisible72: true});;
Refresh(Pool_1);;
If(
    !IsEmpty(
        Filter(
            Pool_1;
            ID = ThisItem.ID
        )
    );
    Patch(
        Pool_1;
        LookUp(
            Pool_1;
            ID = ThisItem.ID
        );
        {TookOverBy: User().Email};
        {TookOverDate: currentime}
    )
;"");;
Refresh(Pool_1);;
If(
    !IsEmpty(
        Filter(
            Pool_1;
            ID = ThisItem.ID && TookOverBy = User().Email
        )
    );
    Patch(
        Bestellungen;
        Defaults(Bestellungen);
        {
            Besteller: User().FullName;
            eMail: User().Email;
            Besteller_x0020_ehemalig: ThisItem.Besteller;
            Men_x00fc_ID: ThisItem.MenüID;
            Title: ThisItem.'Menü Name';
            VoucherUsed: ThisItem.VoucherUsed;
            VoucherUsedCode: ThisItem.VoucherUsedCode;
            Beschreibung: ThisItem.Beschreibung;
            Datum: ThisItem.'Bestellt am';
            Anmerkung: ThisItem.Anmerkung;
            TookOverBy: User().Email;
            TookOverDate: currentime;
            AddedToPoolBy: ThisItem.AddedToPoolBy;
            AddedToPoolDate: ThisItem.AddedToPoolDate;
            Extra1: ThisItem.Extra1;
            Extra2: ThisItem.Extra2;
            Extra3: ThisItem.Extra3;
            Preis: ThisItem.Preis;
            Bestellbar_x0020_Von: ThisItem.'Bestellbar Von';
            Bestellbar_x0020_Bis: ThisItem.'Bestellbar Bis';
            Angebot_x0020_F_x00fc_r: ThisItem.'Angebot Für';
            Vegetarisch: ThisItem.Vegetarisch;
            AllergenA: ThisItem.AllergenA;
            AllergenB: ThisItem.AllergenB;
            AllergenC: ThisItem.AllergenC;
            AllergenD: ThisItem.AllergenD;
            AllergenE: ThisItem.AllergenE;
            AllergenF: ThisItem.AllergenF;
            AllergenG: ThisItem.AllergenG;
            AllergenH: ThisItem.AllergenH;
            AllergenL: ThisItem.AllergenL;
            AllergenM: ThisItem.AllergenM;
            AllergenN: ThisItem.AllergenN;
            AllergenO: ThisItem.AllergenO;
            AllergenP: ThisItem.AllergenP;
            AllergenR: ThisItem.AllergenR
        }
    );;
    Remove(
        Pool_1;
        ThisItem
    );;
    UpdateContext({BoxVisible72: false});;
    UpdateContext({BoxVisible70: true});
    UpdateContext({BoxVisible71: true})
);;
UpdateContext({BoxVisible69: true});;
UpdateContext({BoxVisible72: false});;Refresh(Pool_1)

 

and in the background I have a timer running at a repeating one second interval to get live data

 

Refresh(Pool_1);;Set(currentime;Now());;ClearCollect(
    ColPoolCount;Filter(
            Pool_1;
            Today() <= 'Angebot Für'
        )
)

 

 

The current problem is that when two users on this Gallery control take over two different menus at the same time, when fetching the data and patching, the This.Item function gets confused and the information doesn't come from the Selected Item It instead gets the information from the above or below element, depending on which element is selected first in that split second of taking over and refreshing the data.

 

I hope someone can help me with this issue.

10 REPLIES 10
WarrenBelz
Super User
Super User

Hi @Ermin ,

Just checking if you got the result you were looking for on this thread. Happy to help further if not.

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Visit my blog Practical Power Apps

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (1,699)