April 23, 201510 yr So I'm pretty new to writing recursive functions and I want to create a function that will contain a list of tables in my solution that contain a specific text phrase. I can use PatternCount and the Get ( TableNames ) function to see that there are 6 tables in my solution that match my search criteria but from there I get stuck. The calculation PatternCount ( Get ( TableNames ) ; "myFile" ) ; "myTextPhrase" ) Returns a value of '6'. How would I write a calculation to return the values of the tables that match the text phrase? Edited April 23, 201510 yr by James Gill
April 23, 201510 yr If you're doing this in a script, why not let the script handle it using a loop, instead of splitting the logic off to a custom function?
April 23, 201510 yr Author I could definitely do it in a script but for this I'm trying to use it in an un-stored calculation field Edit: Realized I specifically said script in my description. Removed it to better describe what I want to do Edited April 23, 201510 yr by James Gill
April 23, 201510 yr You could do it this way: ValuesContaining ( listOfValues ; searchString ) = Let ( [ value = LeftValues ( listOfValues ; 1 ) ; nextList = RightValues ( listOfValues ; ValueCount ( listOfValues ) - 1 ) ] ; Case ( PatternCount ( value ; searchString ) ; value ) & Case ( PatternCount ( nextList ; searchString ) ; ValuesContaining ( nextList ; searchString ) ) ) then call this function as : ValuesContaining ( TableNames ( Get (FileName) ) ; "myTextPhrase" ) Using the TableNames() function directly in the custom function is less convenient, because it doesn't change between iterations - unlike the listOfValues parameter above, that dwindles by one every time. Besides, having a generic custom function that can handle any list of values is way cooler.
April 24, 201510 yr Author I have to ask...why are you doing this? I needed a way to include only tables occurrences with a specific naming convention to use in a 3rd party solution (CCPivot).
April 24, 201510 yr Why not use one call to ExecuteSQL? SELECT TableName FROM FileMaker_Tables WHERE TableName LIKE 'whatever' http://www.databuzz.com.au/using-executesql-to-query-the-virtual-schemasystem-tables/ LIKE with Wildcards The Missing FM 12 ExecuteSQL Reference | FileMakerHacks
April 24, 201510 yr Author God point. In this I was just trying to use a technique that was close to the original method that was being used. As usual and especially with Filemaker, there is usually more than 1 way skin a cat.
April 24, 201510 yr Author Some response would be nice... Oh, weird. I thought I replied last night but apparently my reply got swallowed by the internet troll. Yes, the technique worked perfectly for what I needed it for. Is there a guide somewhere on how recursion words in Filemaker and what functions will work with recursion? I never would have guessed that a native Filemaker function didn't support recursion...
April 24, 201510 yr Something definitely is not working right with this new forum. As you can see from the attached screenshot, you have replied 3 hours ago - but I am still listed as the last poster. âIs there a guide somewhere on how recursion words in Filemaker and what functions will work with recursion? â Only custom functions can be recursive (i.e. call themselves). You can use any function inside a custom function, including itself (hence recursion).
Create an account or sign in to comment