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
  • Nvm, I am talking about the solutions given to you. Sure, try this and let me know how it went:
    {
              if(
                        rule!APN_isEmpty(ri!SVG_IAL1_Employee),
                        {},
                        a!save(
                                  ri!SVG_IAL1_Employee,
                                  apply(
                                            type!(
                                                      employeeId:_,
                                                      firstName:_,
                                                      lastName:_
                                            ),
                                            merge(
                                                      enumerate(fn!length(ri!SVG_IAL1_Employee))+1,
                                                      ri!SVG_IAL1_Employee.firstName,
                                                      ri!SVG_IAL1_Employee.lastName
                                            )
                                  )
                        )
              )
    }

    Please make sure that the above code snippet runs post remove operations on items and itemsToken variables. Also, bear in mind that the entire ri!SVG_IAL1_Employee CDT should be available to gridRowLayout rule.
Reply
  • Nvm, I am talking about the solutions given to you. Sure, try this and let me know how it went:
    {
              if(
                        rule!APN_isEmpty(ri!SVG_IAL1_Employee),
                        {},
                        a!save(
                                  ri!SVG_IAL1_Employee,
                                  apply(
                                            type!(
                                                      employeeId:_,
                                                      firstName:_,
                                                      lastName:_
                                            ),
                                            merge(
                                                      enumerate(fn!length(ri!SVG_IAL1_Employee))+1,
                                                      ri!SVG_IAL1_Employee.firstName,
                                                      ri!SVG_IAL1_Employee.lastName
                                            )
                                  )
                        )
              )
    }

    Please make sure that the above code snippet runs post remove operations on items and itemsToken variables. Also, bear in mind that the entire ri!SVG_IAL1_Employee CDT should be available to gridRowLayout rule.
Children
No Data