Bullzip & NAS issue

Luc_VanDyckLuc_VanDyck Member, Moderator, Administrator Posts: 3,633
I'm using Bullzip to generate pdf-documents, through the NAS (Application Server).

To set the filename of the pdf-file, following code is used
autBullzip.Init;
autBullzip.LoadSettings;
txtRunOnceFile := autBullzip.GetSettingsFileName(TRUE);
autBullzip.SetValue('Output',ptxtPDFFileName);
autBullzip.SetValue('Showsettings', 'never');
autBullzip.SetValue('ShowPDF', 'no');
autBullzip.SetValue('ShowProgress', 'no');
autBullzip.SetValue('ShowProgressFinished', 'no');
autBullzip.SetValue('SuppressErrors', 'yes');
autBullzip.SetValue('ConfirmOverwrite', 'no');
autBullzip.WriteSettings(TRUE);
As said before, this code is executed through the NAS.

Now the issue: in order to generate the pdf, with the correct filename & location I have to restart the NAS-service. When I don't restart the service, the document is generated automatically, but without the correct filename (Bullzip uses the name of the report as filename). After restarting the NAS-service, the correct filename is being used (for example: INV123.PDF).

Does anyone has a clue what is causing this behaviour?
No support using PM or e-mail - Please use this forum. BC TechDays 2024: 13 & 14 June 2024, Antwerp (Belgium)

Answers

  • kapamaroukapamarou Member Posts: 1,152
    You are stressing out that this happens through NAS. Does this mean that the same code has different behavior outside NAS?
  • Luc_VanDyckLuc_VanDyck Member, Moderator, Administrator Posts: 3,633
    No, that's not what I mean.

    The code is only executed through NAS. But when the machine (VPC) is started, the code does not work correctly. When I restart the NAS-service, the code works correctly. ](*,)
    No support using PM or e-mail - Please use this forum. BC TechDays 2024: 13 & 14 June 2024, Antwerp (Belgium)
  • Luc_VanDyckLuc_VanDyck Member, Moderator, Administrator Posts: 3,633
    I found something odd.

    I added
    MESSAGE(txtRunOnceFile);
    
    in my code, to see (in the Event Log), what file Bullzip was using to store the settings.

    When the server (VPC) is started, the result of txtRunOnceFile is:
    C:\Documents and Settings\Administrator\Bullzip\PDF Printer\runonce@Bullzip PDF Printer.ini.

    When the NAS-service is restarted, the result of txtRunOnceFile is:
    C:\Documents and Settings\Administrator\Application Data\Bullzip\PDF Printer\runonce@Bullzip PDF Printer.ini.

    :-k
    No support using PM or e-mail - Please use this forum. BC TechDays 2024: 13 & 14 June 2024, Antwerp (Belgium)
  • Luc_VanDyckLuc_VanDyck Member, Moderator, Administrator Posts: 3,633
    After adding this "hack", it worked as espected:
    [...]
    autBullzip.WriteSettings(TRUE);
    
    IF STRPOS(txtRunOnceFile,'Application Data') = 0 THEN
      FILE.COPY(txtRunOnceFile,STRSUBSTNO(
                 'C:\Documents and Settings\%1\Application Data\Bullzip\PDF Printer\runonce@Bullzip PDF Printer.ini',
                 USERID));
    
    But I hope there is a cleaner way. As now, the solution is not language-independant (names of the folders are different in non-english Windows versions) and some Bullzip-settings are hard-coded.
    No support using PM or e-mail - Please use this forum. BC TechDays 2024: 13 & 14 June 2024, Antwerp (Belgium)
  • kinekine Member Posts: 12,562
    It seems like the service is initialized before the correct data are available to set the path. Try to postpone start of the service (e.g. by adding some dependencies) - you can test it by not starting the NAS during startup and run it manually. Or adding some delay between initializing the BullZip and next commands. It looks like the problem can be "cold" start of the BullZip take some longer time than repeated starting of the service...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
Sign In or Register to comment.