Hi Community,
As I am a beginner in Outsystems I have a requirement where I have an Employees table with Designation, region and Update Button on screen in Table.
So whenever I click on Update Button then only that Particular row must get enabled and can perform Update function for all selected and updated records.
But when I select a record and Navigate to another page and then when I come back then the selected records are gone because of pagination. So is there any way in outsystems that we can avoid this.
On click of confirm button we save all the records that have been edited in table but while saving/ updating records it takes only first value of multiple selected dropdown list
So is there any way to avoid this refresh and save all the selected values from dropdown in DB.I have even attached my .oml file for reference.
It would be a great help if someone from community helps me with this issue.
Thank & Regards,Sanji San.
Hi @Sanji San,
Greetings!
If I have understood your problem correctly, the issue is- you want to enable a row by clicking on the update button and the updated record will be saved on clicking the confirm button. Your problem is, if you try to update some records from the 2nd or 3rd…pages, then the changes are all gone.
These is a very simple way to resolve this issue. I’ll tell you step wise.
1. Create a local variable (list of structure type). Structure should contain designation ID, Region ID and Employee ID.
2. In the pagination client action, the first operation should be List append this local variable with source list (aggregate).
3. Perform the rest of the operations in pagination. Then, after the refresh aggregate, again assign the aggregate values from the list.
This way, your data won’t be lost. Hope this helps.
Thanks,
Ananya
Hi Sanji,I checked your oml and found that you were not utilizing the Selected_EmployeeIdList.I have updated the oml, added GetEmployeesOnAfterFetch event and added the logic to retain record selection using selected employee list.Check the attached updated oml.RegardsKrishnanand Pathak
Hi Krishnanand Pathak,
Thank you for your reply actually it's working for update and enable the row scenario but while saving it is saving only the first value selected in Regions dropdown and if we check there is already a loop for saving the records so if we want to save the values selected in dropdown how that can be done we cannot add loop inside another loop right.
So it would be a great help for me if you check that once so that I will get to know my mistake.
Regards,Sanji San.
You data base structure is incorrect if you are willing to have multiple regions to be stored in db against employees.Current data base structure can not have multiple region for an employee.You need to create another table let say Employee_Regions which will have atrribute EmployeeId and RegionId.Also remove regionId from Employee table(no longer needed).Then create entry in the Employee_Regions table at ConfirmOnClick.
Thank you Krishnanand Pathak,
For replying it's working now as you suggested but there is one issue if I click update button and select values in dropdown and navigate to another screen but when I come back the row is enabled but the selected values are gone.
I tried adding aggregate in onAfterFetch and refreshed the data but it's not working.
SO is there anyway to resolve this issue.