6 Replies Latest reply: May 15, 2014 10:08 AM by pinne65 _ RSS

    SetReportFile hangs for PDF

    pinne65 _

      Hello,

       

      We are invoking Monarch PRO 9.01 using VBA in SSIS trying to parse a PDF. The SSIS package is executed using dtexec32 by xp_cmdshell from a stored procedure on MS Sql Server 2005.

       

      The problem is that as when the SetReportFile function is invoked in this way, it hangs. This only happens when invoked through the stored procedure and xp_cmdshell. If I run the SSIS package directly in Sql Server Management studio it runs fine.

       

      The weird thing that doing the exact same thing with a text file instead of a PDF file works ok. Both VBA scripts follow the same initial patter:

       

      Option Strict Off

       

      Imports System

      Imports System.IO

      Imports System.Data

      Imports System.Math

      Imports Microsoft.SqlServer.Dts.Runtime

       

      Public Class ScriptMain

       

          Const REPORT_FILE = "C:\sansqldata\sqlcolo2-common-sqldata\Projects\StatementReconciliations\Monarch\Reports\BankStatements\WFBank-DepositStatements.pdf"

          Const MODEL_FILE = "C:\sansqldata\sqlcolo2-common-sqldata\Projects\StatementReconciliations\Monarch\Models\WFBankStatements\"

          Const OUTPUT_FILE = "C:\sansqldata\sqlcolo2-common-sqldata\Projects\StatementReconciliations\Monarch\Export\WFBankStatements\"

          Const LOG_FILE = "C:\sansqldata\sqlcolo2-common-sqldata\Projects\StatementReconciliations\Monarch\Models\WFBankStatements\WF Bank.log"

          Const DEBUG_FILE = "C:\sansqldata\sqlcolo2-common-sqldata\Projects\StatementReconciliations\Monarch\Models\WFBankStatements\WFBank.dbg"

       

          Public Sub Main()

       

              Dim oMonarch As Object

              Dim t, openfile, openmod As Boolean

              Dim FilePath, ModelFile As String

              Dim strErrorMsg As String

       

              ErrNotif("OOHH MONARCH 32!")

              oMonarch = GetObject("", "Monarch32")

       

              If oMonarch Is Nothing Then

                  oMonarch = CreateObject("Monarch32")

       

              End If

       

              'oMonarch.DisplayWindow(2)

              oMonarch.Visible = False

       

              t = oMonarch.SetLogFile(LOG_FILE, False)

              ErrNotif("OOHH MONARCH 32 B4 SET REPORT FILE!")

              openfile = oMonarch.SetReportFile(REPORT_FILE, False)

              ErrNotif("OOHH MONARCH 32 AFTER SET REPORT FILE!")

       

              If openfile = True Then

      .

      .

      .

       

      Anyone's 5 Cents are Welcome!

        • SetReportFile hangs for PDF
          Data Kruncher

          Your environment is nothing that I've worked with, but FWIW I'd try loading a project file (SetProjectFile) and ensure that Monarch doesn't display the PDF options dialog when a PDF is opened. There's an option checkbox to suppress that dialog.

           

          Of course the project file will use a default PDF file, but you can open a new one immediately after opening the project file.

           

          Apart from that, I'd be seeking input from Gareth Horton if this isn't a working solution for you.

            • SetReportFile hangs for PDF
              pinne65 _

              I read an earlier post suggesting that and went through all the model files, (Those are the ones with the PDF option checkbox, right?), and made sure the box was unchecked. But regardless of that, the SetReportFile is called before SetModelFile.

               

              I'm not really familiar with Monarch. I inherited this problem. So please bear with my ignorance. But there are no project files, just model files, .xmod, and the report file.

               

              What does a project file do?

                • SetReportFile hangs for PDF
                  Data Kruncher

                  Project files are created by first opening the data source (text report, PDF, Excel file, what have you), and then opening or creating a model for that data source. If it's a newly created model, save the model and then save a new Project file.

                   

                  The project file will then contain the proper information as to the name and location of the data source and the model that should be used with it, so that the result is by opening a single project file, you load both the proper data source and the applicable model.

                   

                  The other primary attraction of project files is that you can define a series of export routines, or "project exports" that will also be saved within the project file. This allows for precise exporting much more easily.

                   

                  But because Monarch allows us to replace the current data source in use with another (without changing the predefined exports or the active model), we can use a project file to open a default data source (which may even be entirely blank), and then replace it with the one that we really want to use.

                   

                  That's what issuing a SetProjectFile command, followed by a SetReportFile would do.

                • SetReportFile hangs for PDF
                  Gareth Horton

                  Hi,

                   

                  I think Sandy is on the right track here.

                   

                  It all depends on the user account used for the xp_cmdshell proxy.  I imagine it is different from the account under which Monarch is generally run.

                   

                  The option to suppress the PDF options is stored at user level in the registry, not in the model.

                   

                  HKEY_CURRENT_USER\Software\Datawatch\Monarch Pro\Settings\ShowPdfInputOptionsAutomatically

                   

                  When this is set to 0, the PDF input options dialog will be suppressed, when set to 1, the dialog will be shown.  The registry key uses a DWORD value.

                   

                  If the account being used to execute Monarch does not have this value set accordingly in the registry, then the options dialog will show. This would very likely cause a hang, since the dialog would be waiting for input it could never possibly receive.

                   

                  You can either set the xp_cmdshell proxy account to the one you use for Monarch (which presumably has the dialog set to suppressed), or create this registry value / ensure the value is appropriate under the user account used by the xp_cmdshell proxy.

                   

                  Gareth

                   

                  Your environment is nothing that I've worked with, but FWIW I'd try loading a project file (SetProjectFile) and ensure that Monarch doesn't display the PDF options dialog when a PDF is opened. There's an option checkbox to suppress that dialog.

                   

                  Of course the project file will use a default PDF file, but you can open a new one immediately after opening the project file.

                   

                  Apart from that, I'd be seeking input from Gareth Horton if this isn't a working solution for you.[/QUOTE]