How can we generate unique Id without making any DB calls i.e directly from SAIL form

Certified Senior Developer

Hi ,

 

I have a scenario, where I have 2 buttons on my form: Add and Submit.

1) A user has to add details(say for example employee details) before submitting the form.

2)Use can add more than 1 employee details. Once these details are added they are displayed in a new grid in the same form.

3) Once the user clicks on Add button , the details get displayed in new grid, but at the same time I need to generate unique Id for each new addition. 

I will remain on the same form until and unless I submit it. Before submitting the form I need t generate unique Ids(say employee Id).

How this can be done from SAIL side. I do not want DB calls, as this might impact the performance?

 

 

  Discussion posts and replies are publicly visible

Parents
  • Hello Diptis,

    I would suggests you to handle by doing DB calls.
    It will avoid you having constraint issues if two or more people work at the same time with the form as i believe there is no way to maintain the track on the IDS generated in the UI.


    If you still want to follow this approach what i think you can do is:
    1.- Create a constant which will keep track on the IDS.
    2.- Use the constant and +1 for each element you need.
    3.- While you click submit you need to update the constant in the process model to the last number you used.

    If more than 2 people use this screen at the same time the IDS are going to be the same and it will try to persist the same ids causing it to crash.

    I hope this gives you a better perspective i also believe some one might have another approach which might help you.
Reply
  • Hello Diptis,

    I would suggests you to handle by doing DB calls.
    It will avoid you having constraint issues if two or more people work at the same time with the form as i believe there is no way to maintain the track on the IDS generated in the UI.


    If you still want to follow this approach what i think you can do is:
    1.- Create a constant which will keep track on the IDS.
    2.- Use the constant and +1 for each element you need.
    3.- While you click submit you need to update the constant in the process model to the last number you used.

    If more than 2 people use this screen at the same time the IDS are going to be the same and it will try to persist the same ids causing it to crash.

    I hope this gives you a better perspective i also believe some one might have another approach which might help you.
Children