Few tips for NAV developers

I have collected few tips maybe could be used in NAV 2009 developing.
Don't claim me too much if this looks to easy... 🙂

  1. Files managing on RTC pc.
    In C/AL we have statements for working with files like: EXISTS(<File_Name>); RENAME(<Old_File_Name>,<New_File_Name>); ERASE(<File_Name>); COPY(<From_File_Name>,<To_File_Name> ) . But this is working only on CC, as on RTC these statements are executed on Service Tier. What to do if we want to managing files on RTC PC?
    I propose to use automation: 'Windows Script Host Object Model'.FileSystemObject.  If we create it using "Client side" parameter, then automation will be loaded on RTC and we can use all functions from it.
    For example functions:
    Function in NAV C/AL Function in automation
    EXISTS(<File_Name>); <automationName>.FileExists(<File_Name>);
    RENAME(<Old_File_Name>,<New_File_Name>); <automationName>.MoveFile(<Old_File_Name>,<New_File_Name>);
    ERASE(<File_Name>); <automationName>.DeleteFile(File_Name>[, BOOL Force]);
    COPY(<From_File_Name>,<To_File_Name> )  <automationName>.CopyFile(<From_File_Name>,<To_File_Name>);
  2. Different view of boolean fields in RTC.
    Usually boolean fields are showed as checkmarks in RTC, but we can make it in different view - show "Yes/No". This could be done by just adding comments to filed trigger "OnDrillDown".
    Here is example what we see in RTC: 1st boolean has comments in trigger as 2nd is typical view.
  3. Usage virtual table 2000000022 "File" in RTC.
    If you are using this virtual table somewhere in CC and now want to transfer functionality to RTC, you need to know few points:
    1. Virtual table will show files/olders on service tier (not on RTC) and this is different from CC where you saw info from user pc.
    2. If you are using table "File" in RTC, then don't use field "Data". In CC it shows "*" if there are data in file, however RTC starts reading all data from file and loads memory/processor.

Thank you

Comments (4)

  1. manger says:

    Thank you for your tips.

    Do you also have a tip, how I can receive in RTC LOCAL events (f.e. phone calls from TAPI driver) for automation objects (with events) in NAV?

  2. Roger Hamann says:

    Thanks for the file tips. Additional question: Do you see any chance to find out if the file is readable (opened by other program, no rights etc.). If done that in C/AL with "IF file.open(…)"

  3. Peter says:

    3.c: Be aware that UNC paths are not supported in the RTC, unless the RTC is executed at the same tier as the NAV Server. (I.e. a development setup)

  4. Vincent Vancalbergh says:


    When creating an automation server variable you can now specify it needs to be instantiated on the client PC. Like Gedas suggests creating the 'Windows Script Host Object Model'.FileSystemObject.

    See here: msdn.microsoft.com/…/dd355255.aspx

Skip to main content