ITPub博客

首页 > IT职业 > IT生活 > 通过TableId和RecId获得数据表记录

通过TableId和RecId获得数据表记录

IT生活 作者:corespeed 时间:2021-09-09 09:10:57 0 删除 编辑

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

相关代码如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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);
}

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/4440/viewspace-2800036/ ,如需转载,请注明出处,否则将追究法律责任。

下一篇: Web APi移除XML格式
请登录后发表评论 登录
全部评论

注册时间:2019-09-09

  • 博文量
    90
  • 访问量
    1012