我的问题:如何删除值并替换新值
InvGSTSummary 中的“我的字段”值:
值1:
“-0%,19291.76,0.00”
“ SE 0%,1068.39,0.00”
“ ST 6%,2000.00,120.00”
“文本列表”的顺序可能每次都更改
值2:
“ SE 0%,1068.39,0.00”
“-0%,19291.76,0.00”
“ ST 6%,2000.00,120.00”
我编写的用于测试的示例公式如下:
InvGSTSumCode = @Word(InvGSTSummary;“,”; 1)
最终结果的值应为:
“-0%,19291.76,0.00”
“ SE 0%,1068.39,64.10”
“ ST 6%,2000.00,120.00”
新更新项目:在08/07/2019
抱歉,我的问题可能不清楚。实际上,我想问的是可以在条件的“字段” [文本列表]上循环(如果找到“ SE ”),而不仅仅是重做其他计算页面。
新更新项:在10/07/2019
提取原始值并替换值的公式
FullSummary := @Trim(@Replace("SE" + @Right(InvGSTSummary; "SE"); "SE"; ""));
STCode := @Word(FullSummary; ","; 1);
Price := @Word(FullSummary; ","; 2);
SST:=@TextToNumber(Price) * 0.06;
CompVal:= STCode +","+Price+","+@Text(SST; "F2");
CompVal
答案 0 :(得分:1)
替换以“ SE”开头的条目的示例:
_entryOld := @Trim(@Replace("SE" + @Right(InvGSTSummary; "SE"); "SE"; ""));
_entryNew := @Word(_entryOld; ","; 1) + ... calculate your new value based on _entryOld;
@Replace(InvGSTSummary; _entryOld, _entryNew);
以下是“循环”获取带有“ SE”的条目的替代方法:
_entryOld := @Trim(@Transform(InvGSTSummary; "entry";
@If(@Contains(entry; "SE"); entry; "")));
更新为您更新的问题:
在最后一行代码中使用@Replace将旧条目(FullSummary)替换为新值(CompVal):
FullSummary := @Trim(@Replace("SE" + @Right(InvGSTSummary; "SE"); "SE"; ""));
STCode := @Word(FullSummary; ","; 1);
Price := @Word(FullSummary; ","; 2);
SST:=@TextToNumber(Price) * 0.06;
CompVal:= STCode +","+Price+","+@Text(SST; "F2");
@Replace(InvGSTSummary; FullSummary, CompVal);