问题
My Question : How to Remove a value and replace a new value
My Field value inside InvGSTSummary :
Value 1:
"- 0%,19291.76,0.00"
"SE 0%,1068.39,0.00"
"ST 6%,2000.00,120.00"
The order of the Text List might change everytime,
Value 2:
"SE 0%,1068.39,0.00"
"- 0%,19291.76,0.00"
"ST 6%,2000.00,120.00"
Sample formula i write for testing as below :
InvGSTSumCode = @Word(InvGSTSummary; ","; 1)
- The question is May i know how to take the First 2 character is "SE" to amend the last 3 value become by (using 1068.39 * 6%=64.1034), than replace the last 3 value become 64.1034
Final Result For the value should be :
"- 0%,19291.76,0.00"
"SE 0%,1068.39,64.10"
"ST 6%,2000.00,120.00"
New Update item: on 08/07/2019
Sorry may be my question not clear. Actually what i want to ask is possible to Loop over the a "field" [text list] for condition (if found "SE") value than just redo other calculation on the page.
New Update item: on 10/07/2019
Formula to extract the orignal value and replace value
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
Result of the formula:
回答1:
- Get field's entry you want to change,
- Calculate entry's new value,
- Replace entry in field.
Example for replacing entry that starts with "SE":
_entryOld := @Trim(@Replace("SE" + @Right(InvGSTSummary; "SE"); "SE"; ""));
_entryNew := @Word(_entryOld; ","; 1) + ... calculate your new value based on _entryOld;
@Replace(InvGSTSummary; _entryOld, _entryNew);
Here is an alternative for the "loop" to get the entry with "SE":
_entryOld := @Trim(@Transform(InvGSTSummary; "entry";
@If(@Contains(entry; "SE"); entry; "")));
Update to your updated question:
Use @Replace in last code line to replace the old entry (FullSummary) with the new value (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);
来源:https://stackoverflow.com/questions/56896485/lotus-notes-how-to-remove-a-value-and-replace-a-new-value