Axapta AX 2009-附加字符
我正在从表中提取/查询数据,并得到一个dups。我想在DUP值的末尾附加一个字符('a'和'B' 下面是代码片段:Axapta AX 2009-附加字符,axapta,dynamics-ax-2009,Axapta,Dynamics Ax 2009,我正在从表中提取/查询数据,并得到一个dups。我想在DUP值的末尾附加一个字符('a'和'B' 下面是代码片段: while select count(recid) from amtExport group by billOfLadingId where amtExport.createddatetime1 >= utcDT { if (amtExport.RecId == 2) { while s
while select count(recid) from amtExport
group by billOfLadingId
where amtExport.createddatetime1 >= utcDT
{
if (amtExport.RecId == 2)
{
while select amtExport1
where amtExport1.billOfLadingId == amtExport.billOfLadingId
{
info(amtExport1.billOfLadingId);
}
}
}
输出:00232763
00232763
00232793
00232793
00232800
00232800
...... 我想在值的末尾加一个字符,比如
00232763A
00232763B
00232793A
0023273B
00232800A
00232800B
.......
感谢你的帮助!
很容易…我注意到的一件事是你正在做<代码> Reord==2 < /Cord>,但是如果有超过2个副本,它们将被跳过。考虑更改为<代码>累加> 1 < < /P> 此外,没有错误检查,因此如果重复项超过26个,显然将使用Z
之后的Ascii字符
AMTExport amtExport, amtExport1;
ASCII asciiLetter;
while select count(RecId) from amtExport
group by billOfLadingId
{
if (amtExport.RecId == 2) // Should this be .RecId > 1?
{
asciiLetter = 65; // Reset letter to 'A'
while select amtExport1
where amtExport1.billOfLadingId == amtExport.billOfLadingId
{
info(amtExport.billOfLadingId + num2char(asciiLetter));
asciiLetter++; // Increase the ascii letter
}
}
}
我知道我很傻,但是如果您只需要
billOfLadingId
,而不需要来自amtExport的其他字段,那么您不必在选择时执行第二个:
while select billOfLadingId, count(recid) from amtExport
group by billOfLadingId
where amtExport.createddatetime1 >= utcDT
{
if (amtExport.RecId > 1)
{
/*
while select amtExport1
where amtExport1.billOfLadingId == amtExport.billOfLadingId
{
info(amtExport1.billOfLadingId);
}
*/
for (i = 1; i <= amtExport.RecId; i++)
{
info(amtExport1.billOfLadingId + num2char(64 + i));
}
}
}
选择billOfLadingId时,从amtExport计数(recid)
比洛夫拉迪吉德分组
其中amtExport.createddatetime1>=utcDT
{
如果(amtExport.RecId>1)
{
/*
同时选择amtExport1
其中,amtExport 1.billOfLadingId==amtExport.billOfLadingId
{
信息(amtExport1.billOfLadingId);
}
*/
对于(i=1;i