Expand my Community achievements bar.

SOLVED

Incrementing table id +1 with .save()

Avatar

Level 1

Hello everyone,

 

I used the solution on this page to insert a data on the specific table:

https://experienceleaguecommunities.adobe.com/t5/adobe-campaign-classic-questions/how-to-get-an-id-o...

 

But when I add a data from this query, the id generated is spaced as 30 value.

 

On the table I was added pksequence sql (pkSequence="deliveryRichSmsId") which allows you to increment the id to +1. (the sql was executed) : 

SELECT CreateSequenceIfNecessary('deliveryRichSmsId', '1000', 'cache 1');

 

var result = sqlExec("INSERT INTO RenDeliveryRichSms (iDeliveryRichSmsId) VALUES (nextval('deliveryRichSmsId'))");

 

With sqlExec() the value set up to +1
but I need to use the solution with ".save()" function to get the id generated.

=> The .save() spaces the id by +30 on each insertion.

 

Do you know if there is a solution to this?

 

Best regards,

Ali

 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hello @AB_93 

 

It is recommended to not increment the counter by 1. The space is to allow the multiple ingestion at once otherwise it could create the duplicate key issue.

 

Could you please share more details on the use case?


     Manoj
     Find me on LinkedIn

View solution in original post

2 Replies

Avatar

Correct answer by
Community Advisor

Hello @AB_93 

 

It is recommended to not increment the counter by 1. The space is to allow the multiple ingestion at once otherwise it could create the duplicate key issue.

 

Could you please share more details on the use case?


     Manoj
     Find me on LinkedIn

Avatar

Administrator

Hi @AB_93,

Was the given solution helpful in navigating through your issue or do you still have the problem? Please share more details if you are still facing the issue. 

Thanks!



Sukrity Wadhwa