获取当前数据源,初始化query对话框的过滤查询值(Report and Button)

(一)Report

--1)Form控件“Button”中的重载 clicked()  事件,传递Form中当前的值给Report

--2)Report 弹出query对话框,重载 init()  和 fetch()方法初始化显示从Button传递过来的值

public boolean fetch()
{

    ESGIQCLine      _ESGIQCLine;
;


    while(_queryRun.next())
    {
        _ESGIQCLine  = _QueryRun.get(tablenum(ESGIQCLine));

        doing something.....................

    }
        
return true;
}

---------------------------------------------------------------------------------------------------------

(二)Form -- Button

 

      获取query初始化对话框在Form中的Btton对象,由于元素对象没有该枚举类型,所以比较特殊,必须使用当前Form中的主表和次表(数据源)的TableNum来做元素对象值。

     button的clicked事件中可以如下,清除上次query运行操作成功的对象元素值,使之显示当前Form的相关值作为query的初始值!

name    name ;

 

    name = 'T:'+num2str(tablenum(CSM_PackingListTable),1,0,1,0)+','

                     + num2str(tablenum(CSM_PackingListLine),1,0,1,0);
    delete_from SysLastValue
                 where SysLastValue.userId == Curuserid()

                 && SysLastValue.elementName == name;

原文地址:https://www.cnblogs.com/Fandyx/p/2761550.html