Hello,
This formula works but how do I get the Approval Names removed from the PendingApprovalNames field since the approval is no more pending with those names
@If(ApprovalNames!=“”;@Trim(@Replace(ApprovalName;PendingApprovalNames;ApprovalNames));“”)
Thank you
Subject: @Replace works but not by removing name from previous field
Make sure that you truly understand how @Replace works - it may not work as you think it does. It’s not a blanket “replace this entire list with this other entire list”, it works by position - the first value in PendingApprovalNames will be replaced with the first value in ApprovalNames, etc.
If you’re trying to remove an entire list of values from another field, you would want to use a different method.
Look at the help for @Keyword
Subject: RE: @Replace works but not by removing name from previous field
Thanks.
When I use this formula in an agent it is removing all the names in PendingApprovals even though they are not in the ApprovalName field. Would appreciate any help with this code.
FIELD PendingApprovals:=“”;
@Trim(@Replace(ApprovalName;PendingApprovals
;ApprovalName));
Subject: Explain what you are trying to achieve exactly
with samples of what you expect your lists to look like before and after. It will make it much easier to understand what you are trying to do a possible solution.
Subject: RE: Explain what you are trying to achieve exactly
PendingApproval fields contains the names “John Doe” “Jane Doe” “Tom Cat”
Document has been approved by “Jane Doe” so the ApprovalName field contains “Jane Doe”
I would like “Jane Doe” to be removed from the PendingApproval field because she has approved.
Thanks a lot
Subject: RE: Explain what you are trying to achieve exactly
Well for that example it would be:
FIELD PendingApproval := @TRIM(@Replace(“john Doe”:“Jane Doe”:“Tom Cat”;“Jane Doe”;“”))
would result in Pending Approval being “john Doe”:“Tom Cat”
Using field names:
FIELD PendingApproval := @TRIM(@Replace(PendingApproval ;ApprovalName;“”))
So you are basically replacing matching values with nothing, then using @trim to remove the nothing values from the list.
Subject: RE: Explain what you are trying to achieve exactly
Then you want to do something like this:
FIELD PendingApproval := @Trim( @ReplaceSubstring( PendingApproval; ApprovalName; “” ) )
@ReplaceSubstring will work regardless of how many values are in the “from” list, unlike @Replace which matches the positions of the values. So every value in ApprovalName would be replaced by a blank, and then the @Trim would remove the blanks.
Subject: RE: Explain what you are trying to achieve exactly
Thank you all so very much!
Subject: @Replace works but not by removing name from previous field
FIELD PendingApprovalNames:=“”