Passing a record parameter to a function.

[:I]Hello all, Warning … new Navision developer questions (although experienced developer). For now, just this one. If passing a record variable to a function parameter which is defined as a record, is it “by reference” or “by value” ? What I’m getting at is, if in the receiving function, that function does SETRANGE and SETFILTERS, is it messing with the ranges and filters that the caller has in his version of the record variable? I want to know if the receiving function has to save the range/filter settings, do what its wants, then reset them back before returning to the caller. Thanks alot. Kracus

I think the answer to your question is that it can work either way. If you want to set filters in the receiving function and have them applied to the record in the calling code, then you must tick the Var column next to the record variable in the parameters tab of the local variables dialog (Shortcut: ‘Alt + V’ followed by ‘A’ in the receiving function). If you don’t tick this (it is unticked by default), then the filters will not be applied back in the calling code. Hope that helps.

HI You have to use Var if you want to keep the filters on the record set. Other wise the system takes fresh records of the table ignoring the filters set before calling the Function. Harikesh

Var checked is by reference which is why the filters remain. Var uncheck is by value.