首页 > IT职业 > IT生活 > 通过TableId和RecId获得数据表记录
很多情况下,我们会需要通过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/ ,如需转载,请注明出处,否则将追究法律责任。