Question
PT Sinarmas Multifinance
ID
Last activity: 26 Feb 2017 12:03 EST
How to Generate Sequence id in Pega
Dear Pega,
How to generate sequence in Pega and set in activity save.
i use database external(Postgres)
thank you very much
-
Like (0)
-
Share this page Facebook Twitter LinkedIn Email Copying... Copied!
Accepted Solution
PT Sinarmas Multifinance
ID
pzGenerateUniqueID in fuction activity sir?? if i use generateuniqueID create id random in database.. i want this id continuesly with sequence in database
i will try use method RDB-Open to select max id in database, after i get this value id, i will +1 in property set. but i don`t know if its work.. ^_^
Areteans Technologies
AU
You can use generateUniqueID OOTB activity
PT Sinarmas Multifinance
ID
but if i use generateuniqueID its not sequence, id random sir.. i want get sequence in postgres
-
Jyothsna Chigullapally
PT Sinarmas Multifinance
ID
and if i use 2 application (pega and eclipse) but in 1 database, how can i generate this ID?
Incessant Technologies
GB
I think you can create a function for generating sequence ID using java Code.
PT Sinarmas Multifinance
ID
Incessant Technologies
GB
No u can create a function and write the java code in it to generate sequenceID and use that in the activity.
PT Sinarmas Multifinance
ID
if i create function, how can i connect it between sequence in postgres and java code?
Cognizant
IN
you can make use of pega OOTB GenerateID activity which is used by pega to generate pyID in case of flow. This automatically makes entry in pega DB table "PC_DATA_UNIQUEID" and OOTB generate no in sequence.
PT Sinarmas Multifinance
ID
if i use pyId, how to synch with postgres? whether the sequence in postgres will be updated automatically?
and if in one case there are two lists how can i generate id, if i use pyId?
thank you
Pegasystems Inc.
IN
use pzGenerateUniqueID function to generate a unique id based on the prefix passed to this utility.
Ex: If prefix is given as "SPEC", id is generated as "SPEC-1"
Accepted Solution
PT Sinarmas Multifinance
ID
pzGenerateUniqueID in fuction activity sir?? if i use generateuniqueID create id random in database.. i want this id continuesly with sequence in database
i will try use method RDB-Open to select max id in database, after i get this value id, i will +1 in property set. but i don`t know if its work.. ^_^
Pegasystems Inc.
IN
No pzGenerateUniqueID function will create it in sequence like spec-1,spec-2,spec-3...etc
PT Sinarmas Multifinance
ID
but if i use 2 application?? and if in database postgres sequence is 7. it will continuesly to 8??
Sopra Steria AG
CH
But if you use two Applications which are inserting in the same Database records it would be not a good idea to handel this on application side.
In my point of view its better to handel this on DB side. For Postgres there is a function (SERIAL) to auto increment the id.
Example: First insert id = 1, Second insert id = 2 and so on.
Example Table creation:
CREATE TABLE COMPANY( ID SERIAL PRIMARY KEY, NAME TEXT NOT NULL, AGE INT NOT NULL, ADDRESS CHAR(50), SALARY REAL );
More Information you can find here:
https://www.tutorialspoint.com/postgresql/postgresql_using_autoincrement.htm
infosys technologies ltd
IN
I understand , but we are dynamically create like if i mapping from ABC-Data-Customer class to Postgredb table at this scenario how could it generate Unique ID.
-
Rajiv Venkatraman