CurrRec,Rec Variable and Clear All Function

mthe80mthe80 Member Posts: 27
Dear all,

Can u explain me about the CurrRec and Rec Variable. I already looked on the help, but it didn't give me any information. Does this thing Hardcoded by Navision? Cause when I read about ClearAll Function, it says that it won't clear the Rec variable.

TIA

Comments

  • Marije_BrummelMarije_Brummel Member, Moderators Design Patterns Posts: 4,262
    Rec is a default variable you get with some navision objects.

    On a form it is the record the user is viewing.
  • mthe80mthe80 Member Posts: 27
    Dear Mark,

    So CurrRec is the record I see on screen. SO does the Rec?
  • Marije_BrummelMarije_Brummel Member, Moderators Design Patterns Posts: 4,262
    Sorry, Don't know CurrRec

    Where have you seen this?

    I was refering to Rec.
  • O-SeeO-See Member Posts: 4
    Codeunits have a property called TableNo

    Help remarks for this is
    Use the lookup to select the appropriate table number. If the codeunit can apply to any table, then choose Undefined.
    If you specify a table number for this property, then you can use the CurrRec global variable in the codeunit and use the Codeunit.RUN Function (Codeunit) to execute the code unit
  • dimanopdimanop Member Posts: 10
    I didn't know CurrRec existed and I've been using NAV for almost 10 years.

    You learn something new every day.

    I can't see the need for it to be honest.

    Just use a Record variable to work on a Table.
  • vaprogvaprog Member Posts: 1,116
    Just because online help says something, that does not mean it is actually true.

    Setting the TableNo property actually adds a VAR Rec : Record ... parameter to the OnRun trigger. No more magic is involved, no CurrRec variable is accessible.

    Codeunit_variable.RUN or CODEUNIT.RUN(ID) can be used with or without the property set. If the property is set you must use the Record parameter, if not you must not. Depending on which variation you use you'll get a compile time error or a run time error if you do it wrong.

    Furthermore, don't look for the value "Undefined" in the lookup, nor try to type it in yourself. There is no such value accepted. Instead, don't define the property, or clear it's value to make it undefined.
Sign In or Register to comment.