This is my first power app and I am trying to save the value (true or false) from a checkbox to a collection along with other data. When you hover over the values for the checkbox they show the new correct values, however the checkbox changes do not save to the collection, only the original values of the checkboxes save. The rest of the data is saving to the collection perfectly. The checkboxes check and uncheck correctly and the labels for the checkboxes change accordingly (this is for testing only). I really don’t know where I am going wrong. I have spent hours trying to figure this out. Please help.
I am initalising the collection on start of the application:
ClearCollect(
colTaskUpdates,
ShowColumns(
Table(Defaults(Consultant_Roster)),
ECR_Date,
Consultant_ID,
Enabled
)
);
Clear(colTaskUpdates);
I have my code for the canvas checkbox set up as follows:
Checked: If(ThisItem.Enabled,true,false)
Label: CheckboxCanvas1.Checked
On Check:
If(
DatePicker1.SelectedDate in colTaskUpdates.ECR_Date,
Update(
colTaskUpdates,
LookUp(
colTaskUpdates,
ECR_Date = DatePicker1.SelectedDate
),
{
ECR_Date: DatePicker1.SelectedDate,
Consultant_ID: DropdownCanvas1.Selected.ECM_Id,
Enabled: ThisItem.Enabled
}
),
Collect(
colTaskUpdates,
{
ECR_Date: DatePicker1.SelectedDate,
Consultant_ID: DropdownCanvas1.Selected.ECM_Id,
Enabled: ThisItem.Enabled
}
)
)
On Uncheck:
If(
DatePicker1.SelectedDate in colTaskUpdates.ECR_Date,
Update(
colTaskUpdates,
LookUp(
colTaskUpdates,
ECR_Date = DatePicker1.SelectedDate
),
{
ECR_Date: DatePicker1.SelectedDate,
Consultant_ID: DropdownCanvas1.Selected.ECM_Id,
Enabled: CheckboxCanvas1.Checked
}
),
Collect(
colTaskUpdates,
{
ECR_Date: DatePicker1.SelectedDate,
Consultant_ID: DropdownCanvas1.Selected.ECM_Id,
Enabled: CheckboxCanvas1.Checked
}
)
)
I am expecting when you uncheck the check box on the screen the value next to the record in the example list below, for May 3, 2024 should have a correct value of false written to the collection as per below.
ECR_Date Consultant Enabled
May 2, 2024 9 true
May 3, 2024 8 false
However, it is updating the collection with the following instead, which is incorrect:
ECR_Date Consultant Enabled
May 2, 2024 9 true
May 3, 2024 8 true
All advice is greatly appreciated.