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

Answers

I recieved some help that that showed me what I was doing wrong and not understanding. It explained the Let function better so I see why my declaration and reference were getting me no where. This worked

Let ( id = Infobase ( anid ) ;
        If ( IsEmpty ( id ) ; anid ;
                                    DuParent ( id )
           ) // if
       )// let

The Let varibles only keep there value for as long as the Let Evaluates is what I learned and it is a great help.

Chris Johnston

Back to questions