Hi PowerApps Users,
I'm very new to building apps and I'm struggling with saving new or updating data.
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,

Report
All responses (
Answers (