Checking if a RecordRef or FieldRef variable is initialized

MTCMTC Member Posts: 159
edited 2006-11-20 in NAV Tips & Tricks
If you need to do this, the best way that I have found is as follows:
IF FORMAT(MyRecordRef) <> '' THEN
BEGIN
    ...
    ...
END;

I consider it to be a little dirty, but it's simple and it works.

The problem is, if there is a constant to do the check I don't know what it is, and you cannot create a checking variable and leave it uninitialized to perform the check, Navision will generate an error with the following.
IF NOT MyRecordRef = UnInitializedRecordRef THEN
BEGIN
    ...
    ...
END;

The error in English would be "Type conversion is not possible because 1 of the operators contains an invalid type. RecordRef = RecordRef"

Comments

  • kinekine Member Posts: 12,562
    I saw some thing about that in version 5.0. May be that it will help you. But I am not sure, the on-line help was not working for the new command...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
Sign In or Register to comment.