December 7, 201015 yr 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"
December 7, 201015 yr Author 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/
December 7, 201015 yr 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?
December 8, 201015 yr Author 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) )))
December 8, 201015 yr 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 ; ¶ ) )
December 16, 201015 yr Author 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 ; ¶ ) )
December 16, 201015 yr 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. :
December 19, 201015 yr Author 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.
Create an account or sign in to comment