February 13, 200916 yr I am looking for someone to coach me through building my first recursive CF. Scenario... Text field 1 record 1 contains "refste231" cf returns "refste" which is everything left of the first number in the string. Text field 1 record 2 contains "1q2w3e" cf returns null because left most char in the string is a number. Text field 1 record 3 contains "r324" cf returns "r" which is everything left of the first number in the string. Any thoughts on how to get this to work?
February 13, 200916 yr You don't really need a recursive calculation for this: Let ( [ num = Filter ( text ; "01234567889" ) ; firstNum = Left ( num ; 1 ) ; pos = Position ( text ; firstNum ; 1 ; 1 ) ] ; Case ( pos ; Left ( text ; pos - 1 ) ; text ) ) However, if you want to use this as an opportunity to learn about custom functions, then try an algorithm like: Check if the first character of text is numeric: if false, return the character, and check if text has more characters: if true, call the function again with the rest of the text.
Create an account or sign in to comment