difference

vikram7_dabas
vikram7_dabas Member Posts: 611
whats the difference b/w the clear and init?explain me by giving the examples.
Vikram Dabas
Navision Technical Consultant

Comments

  • sgg
    sgg Member Posts: 109
    Try Check the C/SIDE Reference Guide.

    You will get your answers there.
    Sunday, Godwin G
  • kriki
    kriki Member, Moderator Posts: 9,132
    In short :
    -"INIT" initialises all fields EXCEPT primary key-fields of a record.
    -"RESET" resets all the filters on a record and sets the SETCURRENTKEY to the primary key
    -"CLEAR" is a combination of RESET" + "INIT" + it also initialises the primary key

    If you initialise a record, it is better to use CLEAR. Use only INIT of you are sure you want to keep the primary-key-fields.
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • Waldo
    Waldo Member Posts: 3,412
    Isn't it also that CLEAR goes back to the database to get a fresh (updated) recordset?

    FYI,
    there is also the CLEARALL statement ... to clear all internal variables, keys, and filters in the object and in any associated objects that contain C/AL code.

    Eric Wauters
    MVP - Microsoft Dynamics NAV
    My blog
  • kriki
    kriki Member, Moderator Posts: 9,132
    Waldo wrote:
    Isn't it also that CLEAR goes back to the database to get a fresh (updated) recordset?
    No, that is SELECTLATESTVERSION.

    Waldo wrote:
    FYI,
    there is also the CLEARALL statement ... to clear all internal variables, keys, and filters in the object and in any associated objects that contain C/AL code.
    Yes, but I am don't think it deletes records in a temptable in that object.
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • Waldo
    Waldo Member Posts: 3,412
    kriki wrote:
    Waldo wrote:
    Isn't it also that CLEAR goes back to the database to get a fresh (updated) recordset?
    No, that is SELECTLATESTVERSION.
    You're right ... hey, it was late :oops:
    kriki wrote:
    Waldo wrote:
    FYI,
    there is also the CLEARALL statement ... to clear all internal variables, keys, and filters in the object and in any associated objects that contain C/AL code.
    Yes, but I am don't think it deletes records in a temptable in that object.
    That, I don't know, but I just wanted to be complete in the matter :wink:

    Eric Wauters
    MVP - Microsoft Dynamics NAV
    My blog