Wednesday, 21 May 2014

How to Change the Child datawindow object dynamically at run time in Powerbuilder

Hi Every one

Hope all fine. Today am going to discuss with how to change the child datawindow name dynamically based on some value or some other thing.

Initially we will setup the child datawindow with the dataobject and will choose the display column and data column.
But what happen if we want to change that child datawindow itself based on the used input. Here is the code.
Here the name Datawindow represents your datawindow name and the column_name represents your column name . And the dd_child_new represents the data object you want to set. Code follows

//Change datawindow child object
Datawindow.Modify("column_name.DDDW.Name=dd_child_new")

// Setting display column
Datawindow.Modify("column_name.DDDW.DisplayColumn='Short_name'")

// Setting data column
Datawindow.Modify("column_name.DDDW.DataColumn='Number'")

DataWindowChild ldwc_child
Datawindow.Getchild("column_name",ldwc_child)
ldwc_child.Settransobject(SQLCA)
ldwc_child.Retrieve()
ldwc_child.Reset()


hope this will help you a bit

Regards
Raj~