FileMaker Forum

1answers

Recursive Custom Function

In my solution that is based on this type of relationship (pic) I have a custom function called Infobase(). What it does is let me deduce the parent of a particular Primary Key. I use it to do things like link Information Topics back to found sets.

So I am imagining that I keep feeding the result of Infobase() back into itself that I can come up with the parent of all parents in a particular topic. I was looking into to recursion in Custom Function and saw some info that said a Custom Function cannot iterate but it can recursively call itself. Assuming that is true I would think that this can be done with my function Infobase(). Eventually the “empty” of the result could insure we are at the highest parent. In my attempt to create a recursive Custom Function I must be doing something wrong?

Chris Johnston

1answers

A Global does the trick

I have been watching some training on FileMaker, and currently the instructor is showing how to build a system that navigates the Layouts in a solution. In the early stage of it, we have only added the back button.

An interesting thing has come up, and I figured I am better off trying to fully understand what is going on rather than just be satisfied I can get it working in my solution.

For the back button we built one Script that get attached to the Layout via a Trigger (it stores a variable that is list of Layout numbers) and one that gets attached to the button (It retrieve the Layout we want to return to and removes it from list).

The instructor then explained why it wouldn't work (seems like it should). He says that the other scripts firing on the Layout will clash with it so it cannot do its job. He goes on to show a procedure that fixes the problem. I present it in the pictures, I think what is going on here is it is he is creating a clause that will say “no matter what, create a situation for this to run” but that is just what I see.

What does this $$Nav global variable (pic) do for you that makes it work (it does work)?

Chris Johnston

1answers

Variable in ExecuteSQL?

Is it possible via ExecuteSQL to use a variable like this?

Let (

@sort = INFORMATION::exsqlsort

ExecuteSQL ( " SELECT \"name\" FROM \"TOPICLIST\"

WHERE \"_fk_infoparent_id\" = ?
ORDER BY \"name\" @sort" ;

"";

"";

INFORMATION::_kp_information_id

)

)

Then I would go to a field named INFORMATION::exsqlsort setup as radio button with the choices ASC and DESC.

Chris Johnston