Temporary Tables as Parameters

sabzamsabzam Member Posts: 1,149
Can temporary tables be passed over as parameters to functions?

Comments

  • costascostas Member Posts: 27
    if you pass them by reference yes
  • sabzamsabzam Member Posts: 1,149
    Can you kindly specify what by reference mean?
  • Yaroslav_GaponovYaroslav_Gaponov Member Posts: 158
    Hi
    Try so..
    ..In NAV Disigner near this parameter Var column set to TRUE
  • sabzamsabzam Member Posts: 1,149
    Ah ok that was simple. Thanks for your immediate reply
  • BeliasBelias Member Posts: 2,998
    NOTE: As you probably know, passing a parameter byref means that when the procedure finish, it returns the modified value of the variable, so you can pass the temptable in the function without specifying "byref" but if you call the table after the function like this
    clear(temptable);
    function a(temptable);
    temptable.get('OK');
    
    
    ---Function a(temptable : tableyouwant)      !!!not by ref
    temptable.key := 'OK';
    temptable.insert;
    
    you will get an error for an unsuccesful "get"

    if you do this
    clear(temptable);
    function a(temptable);
    
    
    ---Function a(temptable : tableyouwant)      !!!not by ref
    temptable.key := 'OK';
    temptable.insert;
    temptable.get('OK');
    

    the "get" success, because you're in the same function. to pass the temptable outside you clearly have to do
    clear(temptable);
    function a(temptable);
    temptable.get('OK');
    
    ---Function a(temptable : tableyouwant)      !!!BY REF
    temptable.key := 'OK';
    temptable.insert;
    

    Guess it's clear
    -Mirko-
    "Never memorize what you can easily find in a book".....Or Mibuso
    My Blog
Sign In or Register to comment.