MyPage is a personalized page based on your interests.The page is customized to help you to find content that matters you the most.


I'm not curious

Multitable Update using PowerBuilder Datawindow

Published on 03 September 17
0
-1
Multitable Update using PowerBuilder Datawindow - Image 1
// Data Source - Query
SELECT product.productname,
product.supplierid,
product.unitprice,
supplier.contactname,
supplier.city,
supplier.country,
supplier.companyname,
supplier.contacttitle,
product.id,
supplier.id
FROM product,
supplier
WHERE ( supplier.id = product.supplierid )
-- Datawindow is Tabular with SQL Select Datawindow
Multitable Update using PowerBuilder Datawindow - Image 2
Multitable Update using PowerBuilder Datawindow - Image 3
-- In Datawindow Constructor Event
this.settransobject(SQLCA)
This.retrieve()
In the Button Clicked event
integer rtn_1,rtn_2

// Here in below code the product table is the first table and the Supplier table is the second table

rtn_1 = dw_3.update(true,false)
IF rtn_1=1 THEN

dw_3.modify('product_productname.update=No')
dw_3.modify('product_unitprice.update=No')
dw_3.modify("product_id.Key=No")
dw_3.modify( "DataWindow.Table.UpdateTable = ~"supplier~"")
dw_3.modify("supplier_city.update=Yes")
dw_3.modify("supplier_country.update=Yes")
dw_3.modify("supplier_companyname.update=Yes")
dw_3.modify("supplier_contacttitle.update=Yes")
dw_3.Modify("supplier_contactname.update=Yes")
dw_3.modify("supplier_id.Key=Yes")

rtn_2 =dw_3.update(true,true)
If rtn_2 = 1 then
dw_3.modify('product_productname.update=Yes')
dw_3.modify('product_unitprice.update=Yes')
dw_3.modify("product_id.Key=Yes")
dw_3.modify("supplier_city.update=No")
dw_3.modify("supplier_country.update=No")
dw_3.modify("supplier_companyname.update=No")
dw_3.modify("supplier_contacttitle.update=No")
dw_3.Modify("supplier_contactname.update=No")
Commit using sqlca;
dw_3.retrieve ()
messagebox ('message', 'updated successfully!')
Else
Rollback using sqlca;
MessageBox("Table2 Update Failed", "Error : "+SQLca.sqlerrtext)
END IF
Else
Rollback using SQLCA;
MessageBox("Table1 Update Failed", "Error : "+SQLca.sqlerrtext)
end if
Multitable Update using PowerBuilder Datawindow - Image 4
Multitable Update using PowerBuilder Datawindow - Image 5
This blog is listed under Development & Implementations Community

Related Posts:
Post a Comment

Please notify me the replies via email.

Important:
  • We hope the conversations that take place on MyTechLogy.com will be constructive and thought-provoking.
  • To ensure the quality of the discussion, our moderators may review/edit the comments for clarity and relevance.
  • Comments that are promotional, mean-spirited, or off-topic may be deleted per the moderators' judgment.
You may also be interested in
 
Awards & Accolades for MyTechLogy
Winner of
REDHERRING
Top 100 Asia
Finalist at SiTF Awards 2014 under the category Best Social & Community Product
Finalist at HR Vendor of the Year 2015 Awards under the category Best Learning Management System
Finalist at HR Vendor of the Year 2015 Awards under the category Best Talent Management Software
Hidden Image Url

Back to Top