EXPORTOBJECTS and NAS

eYeeYe Member Posts: 168
Hi

Using NAV2009SP1, SQL database.

Is there any reason why EXPORTOBJECTS(gFileName, lRecObject); would fail when running NAS?

It creates the file but that's where it all ends, it hangs and locks the file - it does not export or proceed with the rest of the code.

Code works 100% when executed from a test codeunit, the issue is only when running through NAS.

Regards,
Kind Regards,
Ewald Venter

Comments

  • eYeeYe Member Posts: 168
    The code, incase anyone is interested, and maybe it sheds some light on the problem (Codeunit run from Job Queue Entries):
    PROCEDURE BatchExport@1101772010();
    VAR
      lRecLicensePermission@1101772000 : Record 2000000043;
      lRecObject@1101772001 : Record 2000000001;
      lRecObject2@1101772006 : Record 2000000001;
      lAutFolder@1101772002 : Automation "{50A7E9B0-70EF-11D1-B75A-00A0C90564FE} 1.0:{F0D2D8EF-3890-11D2-BF8B-00C04FB93661}:'Microsoft Shell Controls And Automation'.Folder2";
      lAutMSShell@1101772003 : Automation "{50A7E9B0-70EF-11D1-B75A-00A0C90564FE} 1.0:{13709620-C279-11CE-A49E-444553540000}:'Microsoft Shell Controls And Automation'.Shell";
      lSubDir@1101772004 : Text[100];
    BEGIN
      lRecLicensePermission.RESET;
      IF ISCLEAR(lAutMSShell) THEN
       CREATE(lAutMSShell);
    
      lRecObject.RESET;
      lRecObject.SETFILTER(Type, '>%1', lRecObject.Type::TableData);
      lSubDir := STRSUBSTNO('%1 - %2', FORMAT(TODAY,0,'<YEAR4><MONTH,2><DAY,2>'),
        FORMAT(TIME,0,'<HOURS24,2><Filler Character,0><Minutes,2><Seconds,2>'));
    
      IF lRecObject.FINDSET THEN
       REPEAT
        lRecObject2 := lRecObject;
        lRecObject2.SETRECFILTER;
        lRecLicensePermission.GET(lRecObject.Type, lRecObject.ID);
        IF lRecLicensePermission."Modify Permission" = lRecLicensePermission."Modify Permission"::Yes THEN BEGIN
          lAutFolder := lAutMSShell.NameSpace(gRecJobQEntry."File Path");
          lAutFolder.NewFolder(lSubDir);
     
          EXPORTOBJECTS(gRecJobQEntry."File Path" + lSubDir + '\' + BuildFileName(lRecObject2), lRecObject2);
        END;
       UNTIL lRecObject.NEXT = 0;
    END;
    
    PROCEDURE BuildFileName@1101772020(VAR pRecObject@1101772000 : Record 2000000001) : Text[1024];
    BEGIN
      gFileName := PADSTR('', 10 - STRLEN(FORMAT(pRecObject.ID)), '0') + FORMAT(pRecObject.ID);
    
      CASE pRecObject.Type OF
        1: gFileName := '1.Table.' + gFileName;
        2: gFileName := '2.Form.' + gFileName;
        3: gFileName := '3.Report.' + gFileName;
        4: gFileName := '4.Dataport.' + gFileName;
        5: gFileName := '5.Codeunit.' + gFileName;
        6: gFileName := '6.XMLPort.' + gFileName;
        7: gFileName := '7.MenuSuite.' + gFileName;
        8: gFileName := '8.Page.' + gFileName;
      END;
    
      EXIT(STRSUBSTNO('%1 - %2 - %3.txt', gFileName, pRecObject.ID,
                 CONVERTSTR(pRecObject.Name, '?/\=()|', '_______')));
    END;
    
    Kind Regards,
    Ewald Venter
  • mboon75mboon75 Member Posts: 16
    Good question Eye,

    I'm running into the same issue. It is stuck in the ExportObjects.
    Did you manage to work around this issue?

    Thanks
  • eYeeYe Member Posts: 168
    Hi,

    Unfortunatly not. Coincidently I am working on this again today for the first time in 4 months.
    It is getting kind of critical now for me to get this working.

    Will keep you posted if I find something.

    Regards.
    Kind Regards,
    Ewald Venter
Sign In or Register to comment.