6 Replies Latest reply: May 15, 2014 10:13 AM by Data Kruncher RSS

    Export multiple summaries to file using command line

    svandyk _

      Hi, I'm hoping someone can see what I'm doing wrong with exporting summaries... I have Monarch Pro 10.5. I've had a batch file running which exports one summary to a text file. I now need to export one summary which overwrites the existing file and then add another summary from the same project to the file.  When the command line runs, it looks like it is running the project extracts for each summary but the output file does not include the records that should have been added.

       

      Here's the command line I've been using. Any help you can offer is most appreciated!

      "C:\Program Files (x86)\Monarch\Program\Monarch.exe"

      /rpt:"C:\Documents and Settings\All Users\Documents\Monarch\Export\Hours Export 1 - PR 5 Shift.txt"

      /prj:"C:\Documents and Settings\All Users\Documents\Monarch\Projects\Hours Proj 2 - PR 5 Shift.xprj"

      /mod:"C:\Documents and Settings\All Users\Documents\Monarch\Models\Hours Model2 - PR 5 Shift.xmod" 

      /S  /exp:"C:\Documents and Settings\All Users\Documents\Monarch\Export\Hours Export 2 - PR 5 Shift.txt"

      /expfileopt:overwrite /px:"Hours Export2 - PR 5 Shift"

      /S /expfileopt:add /px:"Hours Export2B - PR 5 Shift"

        • Export multiple summaries to file using command line
          Data Kruncher

          The best approach that you can take would be to simplify the process somewhat, and that would begin by creating a project file for your defined exports. This, you'll recall, basically let you tell Monarch what you want to export, and where you want it to go.

           

          Then you can refer to the project file in your batch file, and simply use the /pxall parameter to have Monarch execute all of the defined exports in the project.

           

          The syntax for Monarch batch files can be tricky to get just right. You might want to download and use the [URL="http://********************/tips/monarch-batch-file-generator"]Monarch Batch File Generator[/URL]. It's a very popular utility, and I even know of a certain software company that uses it internally. :cool:

            • Export multiple summaries to file using command line
              elginreigner _

              It looks like you are calling 2 exports in the same call to Monarch. You need one call per export if you dont use the pxall switch. I use this in my overnight tasks:

              ECHO. NOTES - START - %DATE% - %TIME%

              ECHO. NOTES ..\DAILY\50 - RETURN - NOTES.XPRJ \PXALL

              "c:\Program Files\Monarch\Program\Monarch.exe" "I:\NEWBUSINESS\Import\Monarch Models\DAILY\50 - RETURN - NOTES.XPRJ" /PXALL

              ECHO. NOTES ..\DAILY\60 - RETURN - NOTES.XPRJ \PXALL

              "c:\Program Files\Monarch\Program\Monarch.exe" "I:\NEWBUSINESS\Import\Monarch Models\DAILY\60 - RETURN - NOTES.XPRJ" /PXALL

              ECHO. NOTES ..\DAILY\70 - RETURN - NOTES.XPRJ \PXALL

              "c:\Program Files\Monarch\Program\Monarch.exe" "I:\NEWBUSINESS\Import\Monarch Models\DAILY\70 - RETURN - NOTES.XPRJ" /PXALL

              ECHO. NOTES - FINISH - %DATE% - %TIME%

              /code

              • Export multiple summaries to file using command line
                svandyk _

                Thanks so much for the ideas Data Kruncher!  You have saved me more than once in the past.  I'm working with 2 project exports that each export a summary.  The first export overwrites the previous file.  The second export appends to the file just created.  I tried putting the export of both summaries into one project export in Monarch.  When I used the "All Summaries" option, I ended up with 2 separate output files which pushes my problem down stream to my third project.  It is expecting one file.  So I either need to figure out how to read 2 files in, appending one to the other or get the export to cooperate in project 2.  I used the Monarch Batch File Generator when I initially created the batch file.  I tried to create a new batch file from scratch with the latest version of the Batch File Generator.  It did not recognize the 2nd project export in my project so I couldn't select it.  Any other ideas on how to solve this are appreciated.

                  • Export multiple summaries to file using command line
                    Data Kruncher

                    Let's briefly step through the project export setup. I'm using v10 here. Select the Summary as the view to export. Click Next.

                     

                    Select All Summaries from the list. Before clicking Next, select the radio button to the right for Automatic Naming by tables as opposed to by files. Click Next.

                    Supply the name of the xlsx. Select Overwrite.

                    /LIST

                    This will create two worksheets in the .xlsx file if you have two summaries in your model.

                     

                     

                    If however you need to append the second summary to the exported output of the first summary (below it), then the process is different. Note that the structure and field names of the second summary must exactly match[/B] those of the first summary. Begin defining the two project exports.

                     

                     

                    Select the first summary, and export it to a new .xlsx file, overwriting the file if it exists. Save this as the first defined project export. Run this export now to create the .xlsx file.

                    Build a second project export. Select the same file name, but choose to add data to the file, and then select the table to use, and choose to append data to that existing table. Save this second project export.

                    /LIST

                    Now you can run either one of these project export processes with the /pxall parameter in a batch.