Hi,
I need help with patching a database column when apply button is clicked.
Scenario is very simple but I am unable to work past the error.
I have two tables.
Table 1: Teachers(it has teacher details and one of the fields in question: Seats_Remaining)
Table 2: Tuition(it has the teacher and student details and the status of the tuition)
Scenario:
Student chooses a teacher and then clicks on the 'Apply' button for tuition classes.
Teacher goes to his/her/their profile and checks students applied section. It has two buttons, approve or reject.
When the teacher clicks on 'Approve' button, the patch function should run and update the above two tables with required values.
Update Table 1 against that teacher's entry and add 1 to the value already present in the 'seats remaining' column.
Then update Table 2 against the tuition entry, update the status of the tuition to ongoing.
Rejecting would just change the status to rejected and that's it.
Code that I wrote for the OnSelect property of the accept button is as follows:
Patch
(
'Tuition',
LookUp('Tuition', ID=ThisItem.ID),
{
Tuition_Status: {Value: "Ongoing"}
}
);
Patch
(
'Teachers',
LookUp('Teachers', EID= ThisItem.Teacher_ID),
{
Seats_Remaining: {Value: Seats_Remaining+1}
}
)
This is not working. I have tried a few other permutation combination. I have updated a label with the seats_remaining column data from table Teachers, and then I am adding 1 to the label.text and then storing it in seats.
Nothing works.
Suggestions please.