Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Answered

Value only saves to collection if I add row

(1) ShareShare
ReportReport
Posted on by 4
Hi, 
 
I'm not quite sure how to fix this...
 
I have a gallery(galphyUmg) with one text field that my user will fill with an action. The Items on my gallery(galphyUmg) is set to my collection (colActionphyUmg)
 
 
I have an add row button with the following in OnSelect: 
Patch(colActionphyUmg;ThisItem;{physischeUmgebung:txtphyUmg.Text});;
Collect(colActionphyUmg; {physischeUmgebung:""});;
 
I have a save button which patches it to my sharepoint list HFIX, with the following in OnSelect
ForAll(galphyUmg.AllItems;Patch(HFIX;Defaults(HFIX);{physischeUmgebung:txtphyUmg.Text}));;
Notify("Action successfully saved";NotificationType.Success;4000);;
Refresh(HFIX);;
 
I've noticed it only saves to my collection if I add another row. If I do this then the value plus the blank row gets saved to my sharepoint list. 
 
How can I add just one value to my colection without having to add another row?
 
Thanks for any help, it's appreciated!
 
 
 
 
 
 
 
  • WarrenBelz Profile Picture
    146,702 Most Valuable Professional on at
    Value only saves to collection if I add row
    The code I supplied should filter out any blank row and there is no reason it should not save if a blank row is not added.
  • CU27091340-1 Profile Picture
    4 on at
    Value only saves to collection if I add row
    Hi @WarrenBelz
     
    Thanks so much for your reply. 
     
    I tried it out and it worked. Only my value was saved in my shrepoint list. In my collection, it saved my value and the blank row.  Thank you thank you!
     
    Is there a way around not having to add a row, so that it gets patched to the collection and sharepoint list? Or if there is no way around having to add a row, can this be done automatically? I can imagine that the users would forget to add a row and then they would press save thinking it has been saved.
     
    Thank you!
     
     
  • Verified answer
    WarrenBelz Profile Picture
    146,702 Most Valuable Professional on at
    Value only saves to collection if I add row
    Try patching the collection and filtering out the blank line
    Patch(
       HFIX;
       ForAll(
          Filter(	
             colActionphyUmg;
             Len(physischeUmgebung) > 0
          ) As _Data;
          {physischeUmgebung: _Data.txtphyUmg.Text}
       )
    );;
    Notify(
       "Action successfully saved";
       NotificationType.Success;
       4000
    );;
    Refresh(HFIX);;
    Please click Does this answer your question 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 a Like.
    MVP (Business Applications)     Visit my blog Practical Power Apps    Buy me a coffee
     
     

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,702 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,026 Most Valuable Professional

Leaderboard