June 3, 201015 yr Despite how hard I try I can't incorporate the logic of recursive functions into a working syntax, so any help is appreciated: The task is to selectively remove from a return delimited list either a certain number of characters from the start of each line or up to a certain character (e.g. inderscore _). I suppose that the logic should be something like the following pseudo-code (as if it was a script) 1. Count the number of lines 2. Define the number of characters from start 3. Go to first line 4. Loop 5. Do Replace Function (String; From;To;"") 6. Go to next line 7. Exit Loop if Line > Number of Lines Another thing would also be to be able to define the search character up to which chars will be deleted. Can anyone help? P.S. Help can also contain simple teaching/learning tips if people kindness is great..
June 3, 201015 yr Custom functions are recursive, not iterative. So it might be better to: 1. Process the first value in the list; 2. If the list contains more than one value, call the function again with the remaining values as the parameter.
June 3, 201015 yr Author Hmm. Not quite sure I understand what you mean , can you explain/give example?
June 3, 201015 yr To take a simple example of returning the first word of each item in the list: FirstWords ( listOfValues ) Let ( [ item = GetValue ( listOfValues ; 1 ) ; countValues = ValueCount ( listOfValues ) ] ; LeftWords ( item ; 1 ) & Case ( countValues > 1 ; ¶ & FirstWords ( RightValues ( listOfValues ; countValues - 1 ) ) ) )
June 3, 201015 yr Author Thanks a lot! I think I can tune this to my needs. How do you suggest I should dive into the world of CF and learn swimming? Can you suggest resources or approach?
June 3, 201015 yr There are lot of examples, both here and at: http://www.briandunning.com/filemaker-custom-functions/ http://www.fmfunctions.com/functions.php Some are worth learning from, some less...
Create an account or sign in to comment