• AX 2009 实现对display 方法过滤


    在ax2009中,只能对表字段进行筛选过滤。如果在窗体上显示的不是表字段而是一个display 方法。是不可能像字段一样过滤。如图

    要想对display进行筛选过滤,必须在对应的窗体下面的grid里找到对应的display方法字段。然后重载context方法,并添加如下代码

    public void context()

    {         int selectedMenu;     formrun fr;    

      Args ag;     Name strtext;    

      querybuilddataSource qb1;    

      queryrun qr;     query q;    

      PopupMenu menu = new PopupMenu(element.hWnd());    

      int a = menu.insertItem("根据字段过滤");    

      int b = menu.insertItem("根据所选子段过滤");    

      int c = menu.insertItem("取消过滤");    

    ;

        selectedMenu = menu.draw();    

      switch (selectedMenu)    

      {     case -1: //Filter by field    

        break;    

        case a:    

        ag = new args('SysformSearch');    

        fr = new formrun(ag);    

        fr.run();    

        fr.wait();     //Reading User entered value for filter process    

        strtext = fr.design().controlName('FindEdit').valueStr();    

        if(strtext)    

        {     //Creating a query for filter        

          q = RGD_StudentInfo_ds.query();        

          qb1 = q.dataSourceTable(tablenum(RGD_StudentInfo));        

          qb1 = qb1.addDataSource(TableNum(HRMCourseTable));        

          qb1.addLink(FieldNum(RGD_StudentInfo,hrmCourseId),FieldNum(HRMCourseTable,hrmCourseId));        

          qb1.addRange(FieldNum(HRMCourseTable,hrmCourseRoomId)).value(strtext);        

          RGD_StudentInfo_ds.query(q);        

          RGD_StudentInfo_ds.executeQuery();    

        }    

        break;

          case b: // Filter By Selection        

        q = RGD_StudentInfo_ds.query();        

        qb1 = q.dataSourceTable(tablenum(RGD_StudentInfo));        

        qb1 = qb1.addDataSource(TableNum(HRMCourseTable));        

        qb1.addLink(FieldNum(RGD_StudentInfo,hrmCourseId),FieldNum(HRMCourseTable,hrmCourseId));        

        qb1.addRange(FieldNum(HRMCourseTable,hrmCourseRoomId)).value(disTest.valueStr());        

        RGD_StudentInfo_ds.query(q);        

        RGD_StudentInfo_ds.executeQuery();        

        break;    

        case c : // Remove Filter        

        q = new Query();        

        qb1 = q.addDataSource(tablenum(RGD_StudentInfo));        

        qb1.clearLinks();        

        qb1.clearRanges();        

        RGD_StudentInfo_ds.query(Q);        

        RGD_StudentInfo_ds.removeFilter();        

        break;

          Default:    

       break;

    }

    添加完后得到界面如下:

     
  • 相关阅读:
    【CS Round #46 (Div. 1.5) B】Letters Deque
    【CS Round #46 (Div. 1.5) A】Letters Deque
    【Codeforces Round #432 (Div. 2) A】 Arpa and a research in Mexican wave
    【Codeforces Round #432 (Div. 2) B】Arpa and an exam about geometry
    【Codeforces Round #432 (Div. 1) A】 Five Dimensional Points
    【2017 Multi-University Training Contest
    Managing remote devices
    防止表单重复提交的解决方案整理
    防止表单重复提交的解决方案整理
    日期格式化函数
  • 原文地址:https://www.cnblogs.com/dingkui/p/2567424.html
Copyright © 2020-2023  润新知