X++获取当前选择行记录

X++获取当前选择行记录 

1、“TableName = TableName_DS.cursor()”//TableName_DS是数据源名称

void clicked(){
    ProjTable _projTable;
    super();
    //获取当前记录
    _projTable = ProjTable_DS.cursor();
    if( _projTable.TEK_MosOpportunityID || _projTable.TEK_ProjMosUrl){
        if(_projTable.TEK_ProjMosUrl){
            infolog. urllookup(strfmt("%1", _projTable.TEK_ProjMosUrl));
        }
        else{
            infolog. urllookup(strfmt("https://XXX/lightning/n/My_Sales_MOS?AxSFD__id="+ "%1", _projTable.TEK_MosOpportunityID));
        }
    }else{
        error("未知网址!");
    
    }
  }

2、

void clicked()
{
    MultiSelectionHelper          selectionHelper = MultiSelectionHelper::construct();//Create instance of class
    Set                           selectedRecords = new Set(Types::Record);//Declare a set of type record
    MyLinesTable                  tableLines; //Your table buffer
    super();

    selectionHelper.parmDataSource(MyLinesTable_DS); //Set the datasource
    tableLines  = selectionHelper.getFirst(); //assign to table buffer the reference to selected record(s)

    if (tableLines.RecId)
    {
        while (tableLines)
        {
            selectedRecords.add(tableLines);
            info(strFmt('Selected record.. %1',tableLines.myField));//Display selected record
            tableLines = selectionHelper.getNext();
        }
    }

https://community.dynamics.com/ax/b/applicationdevelopmentblogdynamicsax/posts/get-selected-records-in-a-grid-on-a-form-ax-x

    标签: X++

    Danzel
    Danzel管理员

    • 声明:本文由Danzel于2020-12-17转载(优化),转载须经原站同意并注明出处。
    • 本文地址:http://maryd.cn/?id=146
    上一篇:Dynamics AX Error:For more information about this error navigate to the report..
    下一篇:VendInvoiceJour,VendInvoiceTrans(AX 2012)的AccountingDistribution查询

    留言评论

    暂无留言
    取消
    扫码支持