November 1, 201312 yr Hi! I have a field containing a file name for example: af10-2689_001 I am trying to remove the prepending "af" and everything after the underscore just leaving the xx-xxxx in the middle. This is what I have so far, but it is not working. I am getting an error message that "List usage is not allowed in this calculation." Not sure what I doing incorrectly. GetValue (Substitute (file name ; ["af" ; ""] ; ["_" ; ""] ; ¶ ) ; 1 ) Any suggestion would be most appreciated. Thanks!
November 1, 201312 yr Author Got it! GetValue (Substitute (file name ; ["ck" ; ""] ; ["_" ; "¶"] ) ; 1 )
November 1, 201312 yr Is it "af" or "ck"? And can you be sure there won't be another occurrence of the string in the file name - say "af10-baf9_001"?
November 2, 201312 yr Author Yes. The rest of the values are numeric. Thanks for bringing that to my attention!
November 2, 201312 yr The rest of the values are numeric. Ah. Then you should also note that a dash, when placed between two digits, is NOT a word separator but an underscore is. Therefore = LeftWords ( file name ; 1 ) would return "af10-2689" in your original example, and = Filter ( LeftWords ( file name ; 1 ) ; "0123456789-" ) would also remove ANY non-numerical characters without having to hard-code them, resulting in "10-2689".
November 5, 201312 yr Author Solution Ah. Then you should also note that a dash, when placed between two digits, is NOT a word separator but an underscore is. Therefore = LeftWords ( file name ; 1 ) would return "af10-2689" in your original example, and = Filter ( LeftWords ( file name ; 1 ) ; "0123456789-" ) would also remove ANY non-numerical characters without having to hard-code them, resulting in "10-2689". Perfect!
Create an account or sign in to comment