修改动态报表的时候,尝尝需要根据当前设计里指定的数据源,然后打开AOT去查找,相当的不方便。
于是产生写了一个方法,可以根据传过来的数据源名,去AOT找到TABLE或者VIEW, 直接打开,以便修改。
static void sml_openRefTable(ACT_DynamicRpt dyRpt)
{
TreeNode treeNode; #Define.ViewsPath("\\Data Dictionary\\views\\")
#Define.TablesPath("\\Data Dictionary\\tables\\")
; if( !dyRpt || !dyRpt.RefTableName)
{
throw error(strfmt("%1 cannot open Reference table/view", dyRpt.RefTableName));
} treenode = treenode::findNode(#ViewsPath + "\\" + dyRpt.RefTableName); if( !treenode)
treenode = treenode::findNode(#TablesPath+ "\\" + dyRpt.RefTableName); if( treenode)
treenode.AOTnewWindow(); //相当于在Node上右击打开新窗口展示
}
然后在相应FORM上面加个button,展示。
void clicked()
{
;
super(); ACT_DynamicReportCompiler::sml_openRefTable( ACT_DynamicRpt);
}
发散一下,可以在FORM\sysFormSetup加上相似功能。
实现代码
void fillQueryTreeQueryDatasource(QueryBuildDataSource queryBuildDataSource, int rootId, boolean top = false)
{
//....省略n行代码
//formTreeItem = new FormTreeItem(nodeText,imagelist.image(#ImageDataSource),-1,null);
formTreeItem = new FormTreeItem( nodeText,imagelist.image(#ImageDataSource),-1,
tableid2name(queryBuildDataSource.table()) ); //....省略n行代码
}
void clicked()
{ FormTreeItem formTreeItem;
TableName tablename;
TreeNode treeNode;
#Define.TablePath("\\Data Dictionary\\tables\\")
;
formTreeItem = queryTree.getItem( queryTree.getSelection()); if( formTreeItem.data())
{
tablename = formTreeItem.data(); treeNode = treeNode::findNode( #TablePath + "\\" + tablename); if( treeNode)
treeNode.AOTnewWindow();
} }