Options

From RecRef to Rec

jordi79jordi79 Member Posts: 272
edited 2010-04-21 in Navision Attain
I know how to get from Rec to RecRef. Using RecRec.SETABLE(Rec).

My problem would be, how to get from RecRef back to Rec? The reason is that I did some processing in RecRef, and now I want the processed results back in Rec, so that I can pass it to a function. I know I can of course change the function to take in RecRef instead of Rec, but that would be a lot of work.

Any easy way to do this? I have thought of assigning each field in RecRef to Rec in lines and lines of codes. But this solution seems silly. Any other way to perform this? Help appreciated!

Answers

  • Options
    einsTeIn.NETeinsTeIn.NET Member Posts: 1,050
    No, there is no other way round.
    jordi79 wrote:
    I know I can of course change the function to take in RecRef instead of Rec, but that would be a lot of work.
    I think that's the best solution.
    jordi79 wrote:
    I have thought of assigning each field in RecRef to Rec in lines and lines of codes.
    I think that's not a good solution. What if the table will be expanded by another field?
    "Money is likewise the greatest chance and the greatest scourge of mankind."
  • Options
    krikikriki Member, Moderator Posts: 9,090
    The recordreference has 2 funtions : GETTABLE and SETTABLE.
    If one is to transfer a record to a recordreference, then the other ...

    BTW: the other does NOT transfer filters. Only values.
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • Options
    einsTeIn.NETeinsTeIn.NET Member Posts: 1,050
    Yes, but RecordRef.SETTABLE(Record) doesn't set the filter from your RecordRef to your Record and it does even erase the filter on your RecordRef. So, you can't use in the way you use a Record as a parameter. Or did I miss something?
    "Money is likewise the greatest chance and the greatest scourge of mankind."
  • Options
    jordi79jordi79 Member Posts: 272
    i think u r missing the question here. both SETTABLE and GETTABLE is used to get RecRef from Rec. I need something that will somehow get data from RecRef to Rec, not from Rec to RecRef.
  • Options
    einsTeIn.NETeinsTeIn.NET Member Posts: 1,050
    jordi79 wrote:
    i think u r missing the question here. both SETTABLE and GETTABLE is used to get RecRef from Rec. I need something that will somehow get data from RecRef to Rec, not from Rec to RecRef.
    Maybe I still don't get it, but SETTABLE is for that purpose as you can see in the online help:
    SETTABLE Function (RECORDREF)

    Causes a record variable to use the same table instance as a recordref variable.
    But there are some limitations as mentioned before.
    "Money is likewise the greatest chance and the greatest scourge of mankind."
  • Options
    jordi79jordi79 Member Posts: 272
    Hi einsTeIn.NET,

    My apologies. You are correct. GETTABLE is used to get data from Rec to RecRef, and SETTABLE is used to get data from REcRef to Rec.

    In my NAV version, the description for both GETTABLE and SETTABLE were the same. This led me to believe both the functions were similar. Description for help files below:

    GETTABLE (RecordRef)
    Use this function to make a recordref variable use the same table instance as a record variable.

    SETTABLE (RecordRef)
    Use this function to make a recordref variable use the same table instance as a record variable.
  • Options
    jordi79jordi79 Member Posts: 272
    how, how do i mark this topic as solved?
  • Options
    garakgarak Member Posts: 3,263
    1. Edit your first message
    2. Find the field "Attribute", below the field "Subject"
    3. Set this field to [Solved]
    4. Submit your posting

    Regards
    Do you make it right, it works too!
  • Options
    einsTeIn.NETeinsTeIn.NET Member Posts: 1,050
    Yes, I think the online help was wrong up to 5.01, but it has been corrected in 2009.

    Never mind! I also missunderstood you. Because you said
    jordi79 wrote:
    Using RecRec.SETABLE(Rec).
    ...
    now I want the processed results back in Rec
    I thought you're already using SETTABLE, but you want to pass a set of records to your function. That could be a problem. But if you only want to pass one single record to your function then SETTABLE is the way to go for you. Good luck!
    "Money is likewise the greatest chance and the greatest scourge of mankind."
Sign In or Register to comment.