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

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

Recommended Posts

Posted

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..

Posted

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.

Posted

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 ) )

)

)

Posted

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?

Posted

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...

This topic is 5284 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.