Axapta 创建一个作业,以从表中获取具有特定列格式的记录,并替换为所需格式
我需要在X++中创建一个作业,从表X中获取列id为ER5000123440格式的记录 并将ax中的5替换为-0。5是紧跟在ER后面的数字 更换后,id将为ER-0000123440Axapta 创建一个作业,以从表中获取具有特定列格式的记录,并替换为所需格式,axapta,x++,dynamics-ax-2012-r2,Axapta,X++,Dynamics Ax 2012 R2,我需要在X++中创建一个作业,从表X中获取列id为ER5000123440格式的记录 并将ax中的5替换为-0。5是紧跟在ER后面的数字 更换后,id将为ER-0000123440 Select EXPENSEID from ms_it_dms_staging where EXPENSEID like 'ER4%' and ms_it_dms_staging.FAILUREREASON=3 这是sql中的代码。 你能帮我用x++写这篇文章吗?我前面没有AX,所以可能会有语法错误,但这基本上
Select EXPENSEID
from ms_it_dms_staging
where EXPENSEID like 'ER4%'
and ms_it_dms_staging.FAILUREREASON=3
这是sql中的代码。
你能帮我用x++写这篇文章吗?我前面没有AX,所以可能会有语法错误,但这基本上就是你要做的:
// Declare variable to hold your new ID temporarily
str myNewId;
// Declare the table buffer variable
ms_it_dms_staging ms_it_dms_staging;
ttsbegin; // Begin a transaction
while select forupdate ms_it_dms_staging
where ms_it_dms_staging.EXPENSEID like 'ER5*' &&
ms_it_dms_staging.FAILUREREASON == 3
{
// Do your logic here to change the ID. Make sure this works correctly, may need to adjust the start digit.
// This doesn't need to be in a variable but I'm making it simpler
myNewId = strfmt("ER-0%1", subStr(ms_it_dms_staging.EXPENSEID, 3, maxInt()));
ms_it_dms_staging.EXPENSEID = myNewId;
ms_it_dms_staging.update();
}
ttscommit; // Commit the transaction
你有开始的代码吗?你所要求的是不可能的。为什么需要以这种方式命名列?你需要提供更多的信息。表X是静态表还是需要动态命名列?值正在填充到我尝试替换这些值的表中。我是ax新手。