Lotus Notes:如何除去值并替换新值

时间:2019-07-05 04:16:01

标签: lotus-notes lotus-formula

我的问题:如何删除值并替换新值

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”

InvGSTSummary

我编写的用于测试的示例公式如下:

InvGSTSumCode = @Word(InvGSTSummary;“,”; 1)

enter image description here

  1. 问题是我可以知道如何将前2个字符为“ SE” 将最后3个值修改为(使用1068.39 * 6%= 64.1034) 将最后3个值替换为64.1034

最终结果的值应为:

“-0%,19291.76,0.00”

“ SE 0%,1068.39,64.10”

“ ST 6%,2000.00,120.00”

新更新项目:在08/07/2019

sample

抱歉,我的问题可能不清楚。实际上,我想问的是可以在条件的“字段” [文本列表]上循环(如果找到“ 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

公式的结果after extract value

1 个答案:

答案 0 :(得分:1)

  1. 获取要更改的字段条目,
  2. 计算条目的新值,
  3. 替换字段中的条目。

替换以“ 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);