Question
Evonsys (PVT) LTD
LK
Last activity: 4 Apr 2023 21:11 EDT
Insert Data to External PgAdmin DB table
Hi Team,
This is my PgAdmin 2 table structure,
Customer {ID, Name, Age, Country}
Address {CustomerID, City, Sate} -->> foriegn key (customerID)
Using RDB method I want to insert this data for 2 table. for this senario should I create tow activity or can it do withing one activity ?
-
Like (0)
-
Share this page Facebook Twitter LinkedIn Email Copying... Copied!
NCS Pte. Ltd
SG
Hi @Eranda10274, Can we understand if you are facing any issues during implementation? Technically you can achieve this using single or different activities. It depends on your data structure too. In this case, I see 2 potential classes (Customer and Address). I would suggest to modularise the code ( activity / other code block) in a way that each works independently. I would also suggest to check if you can make use of data pages for data retrieval and save. Please let us know if you are facing any issues.
Thanks,
Devan
Evonsys (PVT) LTD
LK
@ArulDevan No issue, have problem, there is a foriegn key in address so firstly customer should add to table then only we can add address table data, right ?
in my activity I have tried this way
1 -->> use for customer
2 -->> use for address
If first or second method failed , should I rallback all the db commit , right ?
my other problen - -> After the first save method is executed, then only it goes to the bellow method, right ?
NCS Pte. Ltd
SG
Hi @Eranda10274: With foreign key constraint in database, actions will fail if it doesn’t meet criteria. In terms of exception handling, yes you should do. But take note that RDB methods will do auto commit where you cannot handle transactions dependencies (here you can’t do rollback). Please try to use OBJ methods if you want to manage transactions.
In terms of sequence in activity rule, yes it will follow executions step by step (will jump to other steps if any defined).
Please also see the below reference
Thanks.
Evonsys (PVT) LTD
LK
hi @ArulDevan , then how can I Rollback DB transaction if any error occurred ?
Updated: 1 Apr 2023 5:49 EDT
NCS Pte. Ltd
SG
Hi @Eranda10274: If you want to rollback customer data if any failure in address save transaction, I suggest to use OBJ methods followed by commit. Obj method will add the save operation to deferred queue and the commit will be performed once. If any failure in one transaction, both will be rolled back. If this is called from activity, Commit is not mandatory because flow will take care of committing data.
Refer Obj-Save.
Thanks.
Evonsys (PVT) LTD
LK
@ArulDevan Can I use OBJ method for external DB transaction ?
Updated: 1 Apr 2023 21:57 EDT
NCS Pte. Ltd
SG
Hi @Eranda10274, Yes, it can. Are you facing any issues when using obj methods?
Refer Obj-Save.
Thanks.
Evonsys (PVT) LTD
LK
@ArulDevan Thank you. for ur Infromations
NCS Pte. Ltd
SG
Hi @Eranda10274: Please close the thread marking the accepted solution if your question is answered.
Thanks.