Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×
The Claris Museum: The Vault of FileMaker Antiquities at Claris Engage 2025! ×

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

Recommended Posts

Posted

Is there anyone who could easily figure out how to write a custom function - probably a recursive custom function - which would find the text in the biggest gap between a repeating variable. Say we called the function 'crux', with the parameters, 'text' and 'v',

crux (field ; " - ") would equal "Hello world. How are things?" when field equals "orange - blue - green - red - yellow - Hello world. How are things? - apples - cherries - cranberries"

Posted

I figure using something like my 'btwn' custom function would help in this - http://fmforums.com/forum/index.php/topic/62229-in-between-btwn-text-first-fo-second-so/

I figure using something like my 'btwn' custom function would help in this - http://fmforums.com/forum/index.php/topic/62229-in-between-btwn-text-first-fo-second-so/

I figure using something like my 'btwn' custom function would help in this - http://fmforums.com/forum/index.php/topic/62229-in-between-btwn-text-first-fo-second-so/

Posted

find the text in the biggest gap between a repeating variable

Just to make sure I understand this: do you mean return the longest item in a variable-separated list of items?

And if so, what should happen in case of a tie?

Posted

Yes. That's exactly what I mean. If there's a tie, I suppose it should be whichever item comes first.

I could write it non-recursively, but I think it would take too long for filemaker to perform the calculations.

let (a = v & text & v ;

let ([i1= btwn (a ; v ; 1 ; v ; 1) ; i2 = btwn (a ; v ; 2 ; v ; 1); ... i1000 = btwn (a ; v ; 1000 ; v ; 1)];

let (len= max (length (i1) ; length (i2); ... length (i1000) ) ;

case ( length (i1) = len ; i1 ; length (i2) = len ; i2 ; ... length (i1000) = len ; i1000)

)))

Posted

See if this helps:

http://www.briandunning.com/cf/1244

If your list uses another a different separator, you could call the function as:

LongestValue ( Substitute ( YourList ; YourSeparator ; ¶ ) )

Posted

Thanks!

I used that as a subordinate function that does exactly what I wanted:

crux (text ; variable)

If(v=¶ ; LongestValue ( text ) ;

Let (a="apnoeaniorjeoapnfioenapfjoaiiralerlnoiahrafoenai" ;

Substitute(LongestValue(Substitute ( text ; [¶ ; a]; [variable ; ¶])); a ; ¶)))

See if this helps:

http://www.briandunning.com/cf/1244

If your list uses another a different separator, you could call the function as:

LongestValue ( Substitute ( YourList ; YourSeparator ; ¶ ) )

Posted

crux (text ; variable)

If(v=¶ ; LongestValue ( text ) ;

Let (a="apnoeaniorjeoapnfioenapfjoaiiralerlnoiahrafoenai" ;

Substitute(LongestValue(Substitute ( text ; [¶ ; a]; [variable ; ¶])); a ; ¶)))

You got me there - I'm afraid I have no idea what that does. :

Posted

You got me there - I'm afraid I have no idea what that does. :

It should be:

crux (text ; variable)

If(variable=¶ ; LongestValue ( text ) ;

Let (a="apnoeaniorjeoapnfioenapfjoaiiralerlnoiahrafoenai" ;

Substitute(LongestValue(Substitute ( text ; [¶ ; a]; [variable ; ¶])); a ; ¶)))

It's pretty much what you recommended, except it accounts for the possibility (which is common for my purposes) that there will be a ¶ inside of the result that I'm looking to get.

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