Hi Please help me! I need to remove the alphanumeric. Eg.CC/12/F/EX-S/OT/Apr/21 There are totally 7 "/"s. I need to remove last 2 "/"s (/Apr/21). The output will be : CC/12/F/EX-S/OT
There are many ways to do it...... the best is if there is a proper and consistent length of the string. Search in Developer for various Functions like ...$$StringFindAndReplace .... and use the one that suits your purpose.
It may varies the length of the string. Eg.CC/12/F/EX-S/OT/Apr/21 In this I have used a code: Set as :$$StringPart$NSDRFDScheme:ledger:$Partyledgername):0:15 and the output is CC/12/F/EX-S/OT. Another Eg:FDS/12/F/EX-S/OT/Jan/20 For this example, the output is FDS/12/F/EX-S/O. But I need output as FDS/12/F/EX-S/OT. Please help out for this
There has to be some commonality...... e.g. at the end .... there is 3 char month followed by / followed by 2 chars.... so total 6 characters at the end....... if there is such a common thing, then you can first use stringlength to get the length and then deduct 6 chars by using stringPart.
Yes, Pattern has to be common to use that built in function, However we know , it is not going to be the case.. another customer/supplier may have a different pattern altogether like FDS/12/F/EX-S/OT/Jan/2021 or EFDS/12/F/EX-S/OT/January/20 or even FDS/12/F/EX-S/OT/Jan/20-21. So it is better to keep collection of such commonly used character combination in a collection and then remove them while loooooping through the collection... as shown in the code [Code has been edited to give only relevant part here for giving just an idea .. and has not been tested after modification] Code: [Collection : TuAFinYrsUsed] List Name : "/Apr", "/May", "/April", "/Apr/20", "/Apr/21", "/April/20", "/April/21" ; List Name : "2020-2021", "2020-21", "20-21", "2021-2022", "2021-22", "21-22", "2022-2023", "2022-23", "22-23" ; List Name : "GST", "/", "\", "-","'" ; List Name : "/20", "/21", "\20", "\21","/20-21". "\20-21" Fetch : Name [Function : GetFinYearRemoved] Parameter : vInvNumber : String Variable : vTrimInvNumber : String Variable : vFyInvNumber : String Returns : String 050 : Set: vTrimInvNumber : ##vInvNumber 100 : Walk Collection : TuAFinYrsUsed 110 : Do If : (##vTrimInvNumber Contains $Name ): Set: vTrimInvNumber : $$StringFindAndReplace:##vTrimInvNumber:$Name:"" 120 : Do If : (##vTrimInvNumber Contains $Name ) : Continue 900 : End Walk 910 : Set: vFyInvNumber :##vTrimInvNumber ;$$TuARemoveSpecialChars: 950 : Do If : ($$IsEmpty:##vFyInvNumber) : Return :##vInvNumber 990 : Return : ##vFyInvNumber ;$$ZeroFill:##vFyInvNumber:16