Dear All,
I am new to Power Apps, I am working on a project but I am facing an issue which I cannot solve. Could anybody help me or give any advice? In advance, I am sorry for the long description it is because I copied all the relevant attributes below.
I am creating a canvas app which has a screen of gallery control items (see below).
I have dropdown fields, a date picker field and a comment field.
I have also two toggle controls (Zusatzreinigung and wasche service), if these are set to true value, the hours text boxes will be editable, and prices will also be calculated.
If the user changes the values of the above shown fields, the values will be added to a collection (JobUpdates). After clicking on the "Save" button, the values from the collection are sent to a dataverse table.
BUT:
After saving the data and adding new rows to the gallery the priorly recorded values are randomly changing (toggle controlls, the text fields of hours and the content of the comment field)
See below, I added the 00149 record to the gallery. After I hit "Save" the Wasche Service toggle changed to "No" / false, the hours also changed to zero. After Saving, I checked my dataverse table, and the values which are changing are not written into the table. I do not understand this, because as I see, the collection contains all of the changing data values.
Does anyone have an idea what could be the problem? Any help would greatly be appreciated.
The App's OnStart attribute:
ClearCollect(
JobUpdates;
ShowColumns(
Table(Defaults(TESZT_Cleaning_Job));
"cr0f6_job_id";
"cr0f6_partner";
"cr0f6_location";
"cr0f6_room";
"cr0f6_price";
"cr0f6_datetimeofcleaningjob";
"cr0f6_completed";
"cr0f6_teszt_cleaning_jobid";
"cr0f6_commentoncleaningjob";
"cr0f6_zusatzreinigungstunden";
"cr0f6_zusatzreinigungprice";
"cr0f6_wascheservicestunden";
"cr0f6_wascheserviceprice";
"cr0f6_zusatzreinigung";
"cr0f6_wascheservice"
));;
Clear(JobUpdates)
Add row button OnSelect:
Clear(JobUpdates);;
Patch(TESZT_Cleaning_Job;Defaults(TESZT_Cleaning_Job);{Partner: ""; Location: ""; Room: ""; 'Date & Time of cleaning job': Today()})
The gallery items' OnChange property:
If(
ThisItem.cr0f6_teszt_cleaning_jobid in JobUpdates.cr0f6_teszt_cleaning_jobid;
Update(
JobUpdates;
LookUp(
JobUpdates;
cr0f6_teszt_cleaning_jobid = ThisItem.cr0f6_teszt_cleaning_jobid
);
{
cr0f6_teszt_cleaning_jobid: ThisItem.cr0f6_teszt_cleaning_jobid;
cr0f6_partner: Dropdown2.Selected.Result;
cr0f6_location: Dropdown2_1.Selected.Result;
cr0f6_room: Dropdown2_2.Selected.Room;
cr0f6_price: Value(TextInput1_1.Text);
cr0f6_datetimeofcleaningjob: DatePicker1.SelectedDate;
cr0f6_commentoncleaningjob: TextInput1_2.Text;
cr0f6_zusatzreinigung:If(Toggle1_1.Value; 'Zusatzreinigung (TESZT_Cleaning_Job)'.'1'; 'Zusatzreinigung (TESZT_Cleaning_Job)'.'0');
cr0f6_wascheservice:If(Toggle1_2.Value; 'Wasche Service (TESZT_Cleaning_Job)'.'1'; 'Wasche Service (TESZT_Cleaning_Job)'.'0');
cr0f6_zusatzreinigungstunden: Value(TextInput2.Text);
cr0f6_wascheservicestunden: Value(TextInput2_1.Text);
cr0f6_zusatzreinigungprice: Value(TextInput1_3.Text);
cr0f6_wascheserviceprice: Value(TextInput1_4.Text);
cr0f6_completed:If(Toggle1.Value; 'Completed (TESZT_Cleaning_Job)'.'1'; 'Completed (TESZT_Cleaning_Job)'.'0')
}
);
Collect(
JobUpdates;
{
cr0f6_teszt_cleaning_jobid: ThisItem.cr0f6_teszt_cleaning_jobid;
cr0f6_partner: Dropdown2.Selected.Result;
cr0f6_location: Dropdown2_1.Selected.Result;
cr0f6_room: Dropdown2_2.Selected.Room;
cr0f6_price: Value(TextInput1_1.Text);
cr0f6_datetimeofcleaningjob: DatePicker1.SelectedDate;
cr0f6_commentoncleaningjob: TextInput1_2.Text;
cr0f6_zusatzreinigung:If(Toggle1_1.Value; 'Zusatzreinigung (TESZT_Cleaning_Job)'.'1'; 'Zusatzreinigung (TESZT_Cleaning_Job)'.'0');
cr0f6_wascheservice:If(Toggle1_2.Value; 'Wasche Service (TESZT_Cleaning_Job)'.'1'; 'Wasche Service (TESZT_Cleaning_Job)'.'0');
cr0f6_zusatzreinigungstunden: Value(TextInput2.Text);
cr0f6_wascheservicestunden: Value(TextInput2_1.Text);
cr0f6_zusatzreinigungprice: Value(TextInput1_3.Text);
cr0f6_wascheserviceprice: Value(TextInput1_4.Text);
cr0f6_completed:If(Toggle1.Value; 'Completed (TESZT_Cleaning_Job)'.'1'; 'Completed (TESZT_Cleaning_Job)'.'0')
}
)
)
The Default property of the gallery items (in order to show the priorly added records after clicking on the new row button):
If(
IsBlank(ThisItem.Partner);
LookUp(TESZT_Cleaning_Job; cr0f6_teszt_cleaning_jobid = ThisItem.TESZT_Cleaning_Job; Partner);
ThisItem.Partner
)
The OnSelect property of the Save button:
If(
CountRows(JobUpdates) > 0; Patch(TESZT_Cleaning_Job; JobUpdates);Notify("Success";NotificationType.Success));;Clear(JobUpdates)
Thanks a lot!
David
Do you mean in the connecting dataverse table?
the wrong updated values are stored in there.
Hi @freidav1984 ,
All the selected values are getting stored in the list or the wrong updated values are getting stored in the list ?
Hi PG_WorXz10!
Of course:
Default prop (every item has the same, using the proper database column-relation):
LookUp(TESZT_Cleaning_Job; cr0f6_teszt_cleaning_jobid = ThisItem.TESZT_Cleaning_Job; 'Wasche Service')
Reset is "false" at every gallery control item.
Thx
David
Hi @freidav1984 ,
Could you please check the reset and Default property of these controls ? If possible please share the codes Default and reset of these controls
stampcoin
17
mmbr1606
15
Super User 2025 Season 1
ankit_singhal
11
Super User 2025 Season 1