In the implementation of a function, want to get a data window in the Datawindowchild inside SQL, and then put SQL into a datastore to retrieve, the original idea is this
Adw_main.getchild ("xxxx"= ldwc_temp.dataobjectls_sql = Lds_temp.getsqlselect ()
Find Datawindowchild There is no dataobject this attribute
Through Baidu only know can directly through the Datawindowchild Getsqlselect () method to get SQL
SQL is available, and that's the question, how do I get the name of the datawindowchild associated DataWindow?
See the data window of the source to know, this datawindow placed in the Dddw.name property below
<DW Control Name>. Describe ("<COLUMNNAME> Dddw. Name ")<dw Control name>. Modify ("<COLUMNNAME> Dddw. Name=<name of DataWindow used as dddw> ")
This will do it:)
Integer rtncodestring ls_nowfld,ls_deptid,ls_sqldatawindowchild fld_childrtncode= Dw_1.getchild ("unit_id", Fld_child)//get the handle to the UNIT_ID field name pull Data windowIf Rtncode=-1 Then MessageBox ("Error!", "Not dropdown data Window!")) Fld_child. Settransobject (SQLCA)//set Transaction ObjectLs_sql= Lower (fld_child. Getsqlselect ())//get the SQL statement for DDDW//remove the WHERE conditional clause in the SQL statement, such as a WHERE condition clause in the original SQL statement, where you need to perform a more//complex processing should be subject to specific circumstances. ifPos (Ls_sql, "where") >0 then Ls_sql = Left (Ls_sql,pos (Ls_sql, "where"))//to reset a WHERE Condition clause in an SQL statementLs_deptid=dw_1.object.dept_id[getrow ()]//gets the current dept_id selected valueLs_sql= Ls_sql + "Where dept_id = '" +trim (ls_deptid) + "'"//To reset the SQL statementFld_child. Setsqlselect (Ls_sql) fld_child. Retrieve ()//get the data that meets the criteria
Get Datawindowchild SQL and DataObject in PB DataWindow