The getchild function is mainly used to obtain the child data window of a data window.

Source: Internet
Author: User
This function can be used in two cases. 1. Retrieve the drop-down data window of the data window object;
2. Retrieve the child data window objects embedded in the composite data window objects.
Syntax: integer dwcontrol. getchild (string name, ref datawindowchild
Dwchildvariable)

Example 1: This program extracts two child data windows of a composite data window object and filters and sorts them.

/* Dw_dy is a data window control that connects to a composite data window object. Dw_1 and dw_2 are the names of nested data windows */

String ls_filter
Datawindowchild dwc_czrw, dwc_czx // defines the child data window variable
Dw_dy.settranso B j e c t (sqlca)
Dw_dy.retrieve ()
Dw_dy.getchild ("dw_2", dwc_czrw)
Dw_dy.getchild ("dw_1", dwc_czx)
Ls_filter = "czrw_bh = '" + dw_3.getitemstring (dw_3.getrow (), "czrw_bh") + "'" // filter Condition
Dwc_czr1_setfilter (ls_filter)
Dwc_czr1_filter ()
Ls_filter = "czx_rwbh = '" + dw_3.getitemstring (dw_3.getrow (), "czrw_bh") + "'"
Dwc_czx.setsort ("czx_sx ")
Dwc_czx.sort ()
Dwc_czx.setfilter (ls_filter)
Dwc_czx.filter ()

Of course, you can also operate data in the subdata window through data sharing.
Access the composite data window object. Method: dw_dy.o B j e c T. dw_1.o B j e c T. Object

Example 2 Dynamic Filtering in the drop-down data window

Write the following script in the itemfocuschanged event of the data window dw_1:
Integer rtncode
String ls_nowd, ls_deptid, ls_ SQL
Datawindowchild fld_child
Rtncode = dw_1.getchild ("unit_id", fld_child) // obtain the handle of the unit_id field name drop-down data window

If rtncode =-1 then MessageBox ("error! "," Not the drop-down data window! ")

Fld_child.settransobject (sqlca) // sets the transaction object

Ls_ SQL = lower (fld_child.getsqlselect () // obtain the SQL statement of dddw

// Remove the WHERE clause from the SQL statement. If the original SQL statement must have a where clause, compare

// Complex processing depends on the actual situation.

If pos (ls_ SQL, "where")> 0 then ls_ SQL = left (ls_ SQL, pos (ls_ SQL, "where "))

// Reset the WHERE clause in the SQL statement

Ls_deptid = dw_1.object.dept_id [getrow ()] // obtain the selected value of the current dept_id

Ls_ SQL = ls_ SQL + "where dept_id = '" + trim (ls_deptid) + "'"

// Reset the SQL statement

Fld_child.setsqlselect (ls_ SQL)

Fld_child.retrieve () // obtain data that meets the conditions

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.