cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
keihimekawa
Helper III
Helper III

Saving items in Gallery

Hi guys,

 

I have a gallery which contains several info I pulled from a SP List. The data are showing just fine in the gallery but I'm having problems in saving the data back into SP. I don't have any forms in my PowerApp. Just a Gallery. And in the gallery, I have the following:

  1. check box - this identifies the id of the item in the gallery that's selected
  2. radio button - simply yes or no
  3. a text box - which only appears if user selects "No"
  4. button - which does a batch submit of items

I used the following formula in my "submit" button 

 

ForAll(
    RenameColumns(
        Filter(
            collPeople,
            IsModified
        ),
        "ID",
        "GallID"
    ),
    Patch(
        'SPList',
        LookUp(
            'SPList',
            ID = GallID
        ),
        {
            'SPListField': radiobutton.Selected.Value,
            Remarks: txtRemarks.Text
        }
    )
);
ClearCollect(
    collPeople,
    AddColumns(
        'SPList',
        "IsModified",
        false
    )
);

 

The formula submits my changes but it just won't get the correct values.

PA1.png

1 ACCEPTED SOLUTION

Accepted Solutions
v-siky-msft
Community Support
Community Support

Hi @keihimekawa ,

The issue is from the Data source of ForAll function, it should be the Gallery.AllItems instead of the SharePint list, since the modification is reflected on control inside the gallery, not on the sharepoint list yet.

Please try this:

ForAll(
    RenameColumns(
        GalleryName.AllItems,
        "ID",
        "GallID"
    ),
    Patch(
        'SPList',
        LookUp(
            'SPList',
            ID = GallID
        ),
        {
            'SPListField': radiobutton.Selected.Value,
            Remarks: txtRemarks.Text
        }
    )
);

 Sik

View solution in original post

3 REPLIES 3
keihimekawa
Helper III
Helper III

I tried changing the "Patch" area into something like this and it's still not working 😞 It only gets the first item and copies everything to the rest of the affected items.

Patch(
        'SPList',
        LookUp(
            'SPList',
            ID = GallID
        ),
        {
            'SPListField': Gallery1.Selected.radiobutton.Selected.Value,
            Remarks: Gallery1.Selected.txtRemarks.Text
        }
    )

PA2.png

v-siky-msft
Community Support
Community Support

Hi @keihimekawa ,

The issue is from the Data source of ForAll function, it should be the Gallery.AllItems instead of the SharePint list, since the modification is reflected on control inside the gallery, not on the sharepoint list yet.

Please try this:

ForAll(
    RenameColumns(
        GalleryName.AllItems,
        "ID",
        "GallID"
    ),
    Patch(
        'SPList',
        LookUp(
            'SPList',
            ID = GallID
        ),
        {
            'SPListField': radiobutton.Selected.Value,
            Remarks: txtRemarks.Text
        }
    )
);

 Sik

Thanks so much, @v-siky-msft! This definitely worked. I'm fairly new in PowerApps and am trying to figure things out. Your response did made a lot of sense.

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.

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 (4,050)