很多情况下,我们会需要通过TableId和RecId来直接获得数据表记录。比如在Dynamics AX中实现全文检索的时候,一种合理的设计就是让全文检索返回RecId,然后再根据不同的TableId构建数据表实例,最终根据返回的RecId获得数据表记录,从而将结果显示给用户。

相关代码如下:

static void Job2(Args _args)
{
    RecId           recId       = 5637144576;
    TableId         tableId     = 77; // CustTable
    Common          common;
    SysDictTable    dictTable;
    CustTable       custTable;
    ;
    
    dictTable = new SysDictTable(tableId);
    common = dictTable.makeRecord();
    
    select firstonly common
               where common.RecId == recId;
               
    // Here we got a CustTable record 
    // whose RecId is 5637144576
    
    custTable = common; // Assign to CustTable
    
    info(custTable.Address);
}

相关文章:

  • 2021-07-03
  • 2022-03-01
  • 2021-11-09
  • 2021-09-21
猜你喜欢
  • 2022-01-09
  • 2022-12-23
  • 2022-12-23
  • 2021-12-26
  • 2021-08-07
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案