继续浏览精彩内容
慕课网APP
程序员的梦工厂
打开
继续
感谢您的支持,我会继续努力的
赞赏金额会直接到老师账户
将二维码发送给自己后长按识别
微信支付
支付宝支付

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

sky_520
关注TA
已关注
手记 55
粉丝 92
获赞 3386

很多情况下,我们会需要通过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);
}
打开App,阅读手记
0人推荐
发表评论
随时随地看视频慕课网APP