Adding a new row in a grid(interface)

Hi

I want to auto increment a user defined id in a grid when a new row is added.
I was able to increment the id but facing an issue...
Test scenario:
Add 2 new rows,delete the 1st row,
again add a new row.
In this scenario am getting the repeated id.
This is because i have used grid row index for id increment,
Please refer the attached screenshots for more details.

Can anybody suggest me how to handle this scenario.

Thanks in advance.

OriginalPostID-239262



  Discussion posts and replies are publicly visible

Parents
  • @sowjanyav At a high level, what I could say is, if you are assigning the values(NOT displaying) to a field upon adding a row to the grid, make sure that upon deletion of rows in the grid, certain operations are performed which will refresh the assigned values. For instance, let's say you have added 10 rows as per your logic, and now deleted certain rows of your wish. Now it's your responsibility to reassign the fresh values back to the field upon each deletion. Because it's you that has assigned values upon adding a row and again it should be you who should refresh and reassign the values upon deletion.

    Your delete link's saveInto should additionally perform a similar operation: (For time being let's assume we are using 1,2,3 and so on for employeeId.)

    {
    \t/*This will reassign the fresh values to the employeeId field upon deleting a row in the middle, or at first or last.*/
    \tif(
    \ trule!APN_isEmpty(ri!SVG_IAL1_Employee),
    \ t{},
    \ ta!save(
    \ tri!SVG_IAL1_Employee.employeeId,
    \ tenumerate(fn!length(ri!SVG_IAL1_Employee))+1
    \ t)
    \t)
    }
Reply
  • @sowjanyav At a high level, what I could say is, if you are assigning the values(NOT displaying) to a field upon adding a row to the grid, make sure that upon deletion of rows in the grid, certain operations are performed which will refresh the assigned values. For instance, let's say you have added 10 rows as per your logic, and now deleted certain rows of your wish. Now it's your responsibility to reassign the fresh values back to the field upon each deletion. Because it's you that has assigned values upon adding a row and again it should be you who should refresh and reassign the values upon deletion.

    Your delete link's saveInto should additionally perform a similar operation: (For time being let's assume we are using 1,2,3 and so on for employeeId.)

    {
    \t/*This will reassign the fresh values to the employeeId field upon deleting a row in the middle, or at first or last.*/
    \tif(
    \ trule!APN_isEmpty(ri!SVG_IAL1_Employee),
    \ t{},
    \ ta!save(
    \ tri!SVG_IAL1_Employee.employeeId,
    \ tenumerate(fn!length(ri!SVG_IAL1_Employee))+1
    \ t)
    \t)
    }
Children
No Data