Using the GetChild() function on Nested DataWindows
From the PowerBuilder help files:
Getchild() provides a reference to
a child DataWindow or to a report in a composite DataWindow,
which you can use in DataWindow functions to manipulate that DataWindow or report.
According to the definition above,
a call to GetChild ( ) for the nested report that is part of
a tabular (or other) DataWindow fails and the function returns -1.
So there is no way you can get a reference to
the nested DataWindow that is part of a non-composite DataWindow.
The following method enables the usage of
the getChild() function also on such non-composite DataWindows.
1. Export your Tabular, Freeform, Grid, Graph ( or whatever )
style base DataWindow in the library painter.
2. In the third line of the export file change "processing=0" (or whatever)
to "processing=5". This is the actual trick ie. to impose
the functionality of a composite DataWindow (it has processing=5).
3. Import the exported and modified file back.
4. You can call GetChild ( ) on your nested DataWindow as you "normally" would.
Now you have the power of the datawindowchild functions at hand,
which means you could easily modify nested reports
after the retrieve ie. Filtering and Sorting etc.
NOTICE:
The method described above is an undocumented
and NOT SUPPORTED by Sybase and should be used with caution.
--------------------------------------------------
在嵌套数据窗口上使用GetChild()函数
从PowerBuilder的帮助文件得知:
“GetChild()在复合数据窗口中提供一个对子数据窗口或者报表的引用,
你可以在数据窗口函数中使用这个引用来操作那个数据窗口或者报表。”
根据上面的定义,为Tabular(或其他)数据窗口中的嵌套报表调用GetChild()会失败并且函数返回-1。
所以你没有办法获得对非复合数据窗口中嵌套数据窗口的引用。
下面的方法使getChild()在这种非复合数据窗口上也能够使用:
1、在库画板中导出你的Tabular, Freeform, Grid, Graph (或者无论哪种)类型的数据窗口;
2、在所导出文件的第三行,把“processing=0” (或者无论是什么) 改成 “processing=5”。
这是目前的诀窍,也就是把复合数据窗口(processing=5)的功能强加上去。
3、把导出并修改后的文件导入回去。
4、你可以在嵌套数据窗口中“正常地”调用GetChild()了。
现在,你手中拥有子数据窗口函数的权力了,这意味着你可以在提取也就是Filtering和Sorting等等之后很容易地修改嵌套报表了。
注意:
上面所描述的方法没有被Sysbase正式发布和支持,应该谨慎使用。