Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 5760 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

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?

Posted

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.

This topic is 5760 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.