web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Patching for Gallery (...
Power Apps
Answered

Patching for Gallery (only updated the first gallery input)

(0) ShareShare
ReportReport
Posted on by 13

Hi PowerApps Gurus,

 

I managed to patch my SharePoint from two sources, one from the drop-down list and another from the gallery.

However, I realized that my update for the gallery is only taking my first input i.e. if I have two items in the gallery and I input 100 and 200 respectively, my SharePoint will update both items as 100.

 

not sure if any gurus can help me :). I'm grateful and thank you. 

my code below: 

 

ForAll(
colBulk As ir,
Patch(
'Official KrisFlyer Miles Declaration',
LookUp(
'Official KrisFlyer Miles Declaration',
ID = ir.ID
),{'Option Submitted':ddlOptions1.Selected});

Patch(
'Official KrisFlyer Miles Declaration',
LookUp(
'Official KrisFlyer Miles Declaration',
ID = ir.ID
),{'Actual Miles Declared':TextInput2_1.Text})
);

Clear(colBulk);
Reset(ddlOptions1);
Navigate(Screen1,ScreenTransition.Cover)

Categories:
I have the same question (0)
  • Rajkumar_M Profile Picture
    3,747 Moderator on at

    Hi @Simplyisabella 

     

    The ForAll function is used to iterate over a collection and perform an action for each item in the collection. However, in your code, you are using the same patch function twice within the ForAll loop, which is causing the second patch to overwrite the first one.

    To fix this issue, you can combine the two patch statements into a single patch statement within the ForAll loop.

     

    ForAll(
    colBulk As ir,
    Patch(
    'Official KrisFlyer Miles Declaration',
    LookUp('Official KrisFlyer Miles Declaration', ID = ir.ID),
    {
    'Option Submitted': ddlOptions1.Selected.Value,
    'Actual Miles Declared': TextInput2_1.Text
    }
    )
    );

    Clear(colBulk);
    Reset(ddlOptions1);
    Navigate(Screen1, ScreenTransition.Cover)


    Thanks!

     

    If my response has been helpful in resolving your issue, I kindly request that you consider clicking "Accept as solution" and "giving it a thumbs up" as a token of appreciation. 

  • Simplyisabella Profile Picture
    13 on at

    Hi Guru Rajkumar_404,

     

    I'm still having the same issue. Not sure if you have any other advice for me 🙂 Thank you so much for your reply.

    Screenshot 2023-09-07 at 9.49.23 PM.png
  • Rajkumar_M Profile Picture
    3,747 Moderator on at

    Try this

     

    if ddLOptions1 is dropdown control you should use .Value, make change like this


    'Option Submitted': ddlOptions1.Selected.Value,

     

    ForAll(
    colBulk As ir,
    Patch(
    'Official KrisFlyer Miles Declaration',
    LookUp('Official KrisFlyer Miles Declaration', ID = ir.ID),
    {
    'Option Submitted': ddlOptions1.Selected.Value,
    'Actual Miles Declared': TextInput2_1.Text
    }
    )
    );

    Clear(colBulk);
    Reset(ddlOptions1);
    Navigate(Screen1, ScreenTransition.Cover)

     

     Thanks!

  • Simplyisabella Profile Picture
    13 on at

    Hi Guru Rajkumar_404,

     

    the ddlOption1 is a drop down which will apply to all the items in the colBulk. So far that part could work. 

    the TextInput2_1 in a gallery (Gallery1_1) which show the respective Item of ColBulk. User could input the corrected airmiles into the gallery accordingly if he does not agree with what we have provided to them. The issue is when there are more than one item in the gallery, the patching is only taking the first input. Not sure how should i tweak the code to make the app identify the different id and patch accordingly at the gallery level. 

     

    the first code works but not the second one. 

  • Verified answer
    Simplyisabella Profile Picture
    13 on at

    Hi Guru Rajkumar_404,

     

    thanks, i have manage to get the app to look up to the col table for the number to update instead. 

     

    ForAll(
    colBulk As ir,
    Patch(
    'Official KrisFlyer Miles Declaration',
    LookUp('Official KrisFlyer Miles Declaration', ID = ir.ID),
    {
    'Option Submitted': ddlOptions1.Selected,
    'Actual Miles Declared': ir.ActualMilesDeclared
    }
    )
    );

    Clear(colBulk);
    Reset(ddlOptions1);
    Navigate(Screen1, ScreenTransition.Cover)

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 839

#2
Valantis Profile Picture

Valantis 533

#3
Haque Profile Picture

Haque 412

Last 30 days Overall leaderboard