• 获取Form多条选中记录


    1、通过数据源获取记录,以EmplTable为例。

    1 EMPlTable emp;
    2 ;
    3 
    4 for (emp = EmplTable_ds.getFirst(1); emp; emp = EmplTable_ds.getNext())
    5 {
    6   //do something
    7 }
     1 voidclicked()
     2 {
     3   CustTablecustTable;
     4   ;
     5   for (custTable = CustTable_ds.getFirst(true)?CustTable_ds.getFirst(true):CustTable_ds.cursor();  //从当前记录开始,如果当前记录不是第一条
     6      custTable;
     7      custTable = CustTable_ds.getNext())
     8   {
     9     //dosomethingwithcustTable
    10     info(custTable.accountNum);
    11     custTable_ds.research();
    12   }
    13 }

    2、通过勾选CheckBox,获取选中记录。

    (1)先在Form数据源(表中也可以)中创建Eidt()方法。将选中的记录添加到集合中,返回选中记录。

     1 Edit noYes editMark(noYes _set, PriceDiscTable _PriceDiscTable, noYes _mark)
     2 {
     3     ;
     4 
     5     if (_set)
     6     {
     7         if (_mark)
     8             set_PriceRecid.add(_PriceDiscTable.RecId);  //set_PriceRecid是Set集合,使用前要先实例化
     9         else
    10             set_PriceRecid.remove(_PriceDiscTable.RecId);
    11     }
    12 
    13     return set_PriceRecid.in(_PriceDiscTable.RecId);
    14 }

    (2)在Form的Grid中添加CheckBox,并绑定数据源及方法。

    (3)由于是自定义式,全部选择要添加额外的代码。

     1 void clicked()
     2 {
     3     QueryRun        QR;
     4     PriceDiscTable  m_PriceDiscTable;
     5     ;
     6     if (!b_SelectedAll)
     7     {
     8         QR             = new QueryRun(PriceDiscTable_Q);
     9         set_PriceRecid = new Set(Types::Int64);
    10         while (QR.next())
    11         {
    12             m_PriceDiscTable = QR.get(tablenum(PriceDiscTable));
    13             set_PriceRecid.add(m_PriceDiscTable.RecId);
    14         }
    15         PriceDiscTable_DS.research();
    16         b_SelectedAll = true;
    17     }
    18     else
    19     {
    20         set_PriceRecid = new Set(Types::Int64);
    21         PriceDiscTable_DS.research();
    22         b_SelectedAll = false;
    23     }
    24 }
  • 相关阅读:
    Java基础教程:对象比较排序
    算法:深度优先搜索
    微信小程序开发:学习笔记[5]——JavaScript脚本
    微信小程序开发:学习笔记[4]——样式布局
    设计模式:学习笔记(8)——装饰器模式
    设计模式:学习笔记(7)——原型模式
    设计模式——单例模式解析
    玩转Android之数据库框架greenDAO3.0使用指南
    Android开发工具——Android Studio调试技巧
    VR开发的烦恼——范围限制
  • 原文地址:https://www.cnblogs.com/Jinnchu/p/2658713.html
Copyright © 2020-2023  润新知