Batch file to run BAQ Export Process

9.05.702

Has anyone tried running the BAQ Export Process via a batch file? I am trying to schedule one to run but I need to include the yyyymmdd to the .csv it creates. I know you can add the date stamp to the file name via code in a batch file but I’m not sure how to run the BAQ export process first to get the file to then add the date to. Perhaps a different option then what I’m thinking can work? I have tried several different things in the actual BAQ export process screen without any luck.

Any help is appreciated, thank you!

Below method didn’t work.
image

Or does anyone know how to add the ‘yyyymmdd’ to the end of the filename in the ‘Output Filename’ field in my screen shot?

Example of what I’m trying to do is: SOA_20190626.csv

Anyone have any ideas?

Thanks!

Is this SQL?

Ken, sorry for the delayed repsonse. Yes SQL.

Not exactly elegant but…
I have several BAQ exports to CSV that are run once each day on a schedule.
I then have a batch file run by Windows Task Scheduler to rename my CSV files, adding the date stamp (the batch file also copies CSVs from EpicorData to the appropriate, network folder).

Also, I sometimes include date/time stamps right in the BAQ/CSV.
e.g.

  • row 1 fields AND todays date, current time
  • row 2 fields AND todays date, current time
    etc…

image
image

A pre-proc BPM on the BAQ export process could alter the file name sent to the BAQ Export. I used to use this trick in V8 to pass “parameters” to the BAQ.

This following link shows a little of it in V8

BUT don’t get wedded to it as the BAQExport method doesnt exist in E10 :frowning:

Calvin this is actually for version 9 so maybe your idea would work?

Also does anyone know how to set the xml encoding? By default the encoding in the Epicor generated xml file is “ISO8859-1” and it needs to be “utf-16”(for our 3rd party vendor)

Thanks

You could also create a SQL view/procedure (using the BAQ query phase as a guide), then create a SQL Agent Job to do an export to xml.

@SpeedOfLight - Do you have DMT? If you do (and DMT for version 9 has the export capability), you might be able to have your batch file dynamically build the BAQ, and then have it do the post processing for the XML encoding you need

Right, but can you specify the encoding of the xml in SQL? Can we accomplish having the date as part of the file name and also the xml encoding to what we want all via a SQL view/procedure?