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 / adding new or updating...
Power Apps
Unanswered

adding new or updating multiple columns in a gallery to a collection and source

(0) ShareShare
ReportReport
Posted on by

Hi PowerApps Users, 

 

I'm very new to building apps and I'm struggling with saving new or updating data. 

Chiyo018_1-1663476027735.png

 

as per image, I have a gallery, where, for each item, I have multiple columns of data, where the columns refer to a month or week, I'm looking to save the data into a collection first and then patching it to the datasource. 

 

the source schema is as follows:

Title Required Text

ItemID number

DateID number

AssessmentID number

Value number

 

the columns are dynamic, that is, when month is selected, it shows month -2, month -1 ... month + 3, and when a week is selected, it shows each day of the week as 9/1/22, 10/1/22... 14/1/22, etc. each column should be captured as a new line in the datasource, where DateID is the column name (i.e. date)

 

each data entry cell in the gallery has a lookup function: where "ColItemAnswer" is the collection for the source table I want to save

 

 LookUp(ColItemsAnswers,ItemID = ThisItem.ID And AssessmentID = AId And DateTimeValue(DateID) = DateTimeValue(lbl_category_1.Text)).Value

 

my code to save to collection is:

 

ForAll(Gallery1.AllItems As _item,
 Collect(
 ColItemsAnswers,
 {
 AssessmentID: AId,
 ItemID: _item.ID,
 Title: _item.'Product category',
 DateID: DateTimeValue(lbl_category_1.Text),
 Value: Value(txt_d_2.Text)
 },
 {
 AssessmentID: AId,
 ItemID: _item.ID,
 Title: _item.'Product category',
 DateID: DateTimeValue(lbl_category_2.Text),
 Value: Value(txt_d_1.Text)
 },
 {
 AssessmentID: AId,
 ItemID: _item.ID,
 Title: _item.'Product category',
 DateID: DateTimeValue(lbl_category_3.Text),
 Value: Value(txt_d.Text)
 },
 {
 AssessmentID: AId,
 ItemID: _item.ID,
 Title: _item.'Product category',
 DateID: DateTimeValue(lbl_category_4.Text),
 Value: Value(txt_d1.Text)
 },
 {
 AssessmentID: AId,
 ItemID: _item.ID,
 Title: _item.'Product category',
 DateID: DateTimeValue(lbl_category_5.Text),
 Value: Value(txt_d2.Text)
 },
 {
 AssessmentID: AId,
 ItemID: _item.ID,
 Title: _item.'Product category',
 DateID: DateTimeValue(lbl_category_6.Text),
 Value: Value(txt_d3.Text)
 }
 )
)

 

but its not working as intended. numbers are duplicated across all items, instead of returning only entered values

 

 

 

any help will be much appreciated

 

Cheers,

Categories:
  • cha_cha Profile Picture
    4,932 Moderator on at

    Hello @Chiyo018 

     

    Is the table you shared a gallery with boxes? In your approach, the reason for the recurring entry is that it only retrieves one value for the active gallery item selected.  As you can see in your code, your updated value will not retrieve data for each row instances.

     

    cha_cha_0-1663531724983.png

     

    I cannot say that your idea is not workable but if in case you will be short of time, maybe just go with the old method, where once you click the gallery, it will open a form that you can use to update the data.

     

    cha_cha_1-1663532061317.png

     

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 224 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 189 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 126

Last 30 days Overall leaderboard