Hi Everyone!!
I have selected wrong Field as “Use as key” in data class , is there any possible way to change or deleting class is the only way. and i am not able to see created data class in Refactor "Deleting Class
Hi Everyone!!
I have selected wrong Field as “Use as key” in data class , is there any possible way to change or deleting class is the only way. and i am not able to see created data class in Refactor "Deleting Class
You can follow the below steps to change the key.
Please note that Key option in the class record will be enabled only if the data type should not hold any records.
Please follow below mentioned approach for changing key… Use RDB-Open and RDB-Save method in activity and execute below mentioned query.. In dev environment alone before running the below mentioned query export all record(s) from table and make sure in table you are not having any record(s)
1 - Create an Connect SQL and have the below mentioned query under Open method tab… This query is for getting table constraint key value…
Note - While running query please enable tracer, in tracer from RDB-Open method step page you will be able to get Constraint key value..
SELECT con.*
FROM pg_catalog.pg_constraint con
INNER JOIN pg_catalog.pg_class rel
ON rel.oid = con.conrelid
INNER JOIN pg_catalog.pg_namespace nsp
ON nsp.oid = connamespace
WHERE nsp.nspname = ‘customerdata’
AND rel.relname = ‘pr_test_data_outcom’;
customerdata = Table Schema Type = Customerdata/PegaData
pr_test_data_outcom - DB Table
2 - Create another Connect SQL (or) use the same one which you have created earlier and under Save method tab place the below mentioned query. this table is to drop table existing constraint…
ALTER TABLE customerdata.pr_test_data_outcom
DROP CONSTRAINT pr_test_data_outcom_data_outcom_pk;
pr_test_data_outcom_data_outcom_pk = Table Constraint Key Value
3 - Create another Connect SQL (or) use the same one which you have created earlier and under Save method tab place the below mentioned query. This query is to add/change new key…
ALTER TABLE customerdata.pr_test_data_outcom
ADD PRIMARY KEY(test1,test2);
customerdata.pr_test_data_outcom = DB Schema.Table Name
test1,test2 = DB Column Name, which you are trying to have as a key for table.
After this 3 query got executed open the class record rule and update the key… If you need to deploy the changes to higher environment include the DB Schema and Class key in product and deploy. After you deployed the schema and class rule automatically in higher environment table key will get updated and before deploying this query no need to delete any record from table in higher environment…
@Gunasekaran Baskaran
i dont think ALTER TABLE query works under SAVE tab. when i tried in 8.7.4 i was getting DB exception saying ALTER DDL should not use save method. later i kept the query in DELETE tab it worked.
@Gunasekaran_Baskaran : We tried this and it worked in Dev environment , however when we moved this to higher environment the updated key did not move ,please advise