Hi @abuhakeem ,
If you want to handle this directly within PowerApps without using Power Automate, you can use the 'Patch' function to update the SharePoint list.
Assuming you have a button in your PowerApp that submits the form, you can add the following code to the 'OnSelect' property of the button:
// Get the current reward points for the selected employee
ClearCollect(CurrentEmployee, Filter(UserRewards, Employee.DisplayName = YourDropdownControl.Selected.DisplayName));
// Check if there are any existing records for the employee
If(CountRows(CurrentEmployee) > 0,
// If records exist, update the existing record
Patch(
UserRewards,
LookUp(UserRewards, Employee.DisplayName = YourDropdownControl.Selected.DisplayName),
{ RewardPoint: LookUp(UserRewards, Employee.DisplayName = YourDropdownControl.Selected.DisplayName).RewardPoint + 1 }
),
// If no records exist, create a new record
Patch(
UserRewards,
Defaults(UserRewards),
{
Employee: YourDropdownControl.Selected,
RewardPoint: 1
}
)
);
In the above code make sure to replace 'YourDropdownControl' with the actual name of your dropdown control. This way, you can directly update the SharePoint list within PowerApps without the need for a separate Power Automate flow.
Thanks!!!
Please consider marking my response as the accepted solution if it successfully resolves your concern. If you found the information beneficial in other aspects, kindly express your appreciation by giving it a thumbs-up.