Creation of Unique File Exports with Automator - shared success

Altair Forum User
Altair Forum User
Altair Employee
edited October 2018 in Community Q&A

In the process of creating new automated processes, I reviewed numerous postings on this board regarding the creation of unique file names.  While there are some simple solutions, none fit my need.  I thought I'd share my success story.  I am working with Automator 15.0.8.

 

For simplicity, let's say I want to send reports to companies A (Bethlehem SSC), B, C, D and E.  For each file I send, I want to create a summary and detailed tabs for their various departments.  Also, since this report could be run numerous times on the same day, I had to come up with something other than month-day-year to keep them from writing over each other.  Adding seconds likely would have worked if I wasn't using two report types (one a summary and the other appending tabs to the same file for each department to provide detail) which wouldn't let the append work as the seconds macro creates a different file name.  Job number may have worked, but Automator didn't like &{jobid].

 

Within Monarch Classic, I have an external file linked to the detail I've captured to identify which company (A-E) each detail line belongs, which is my Key Field (for the Summary step... with the department detail summaries, the department was my Key Field when creating tabs with the file).  I've created filters for each company and also have summaries for each company.  Within each company summary (in Classic), the Key Field is my very first field, which I've chosen to hide, but for purposes of export naming, I needed to have it there.  Also, when capturing the report data, I needed to find a unique item.  Since there was not a job number, I chose to pick the date and time in the header of the text report, creating a unique field, I'll call Date.

 

Within Automator, I migrated the project into the visual process.  My summary process (SSC Summary), creates separate files by splitting them based on the Key Field (companies A-E).  It names the file using the name macro &[keyvalue] and then adds the Date (however, not named appropriately as SSC Key Field below) with the macro &[firstvalue field].  For the first company (A), it created the file name Bethlehem SSC 249pm 10-29-18.  Bethlehem SSC (company A) was my Key Field content and 249pm 10-29-18 was other field I added to the name by clicking the macro button, selecting "First value of field..." and then the field I wanted, which was SSC Key Field (currently inappropriately named instead of Date by me in Classic).  Having created that unique file, I needed to be able to access that same file(s) a second time in the next steps to append the detail tabs.  I enter the file path within the destination and then add the macros &[keyvalue] &[firstvalue field] to append.  I do that for each of the companies.  Under File Options, I choose to Add data.  Under Table options, I split tabs using the Key Field.  However, when setting up the summary (within my Monarch Classic model) for company A (Bethlehem SSC), my very first field was the Department.  This creates detail information within each company file for each department.  Once I've created the files I want, I e-mail them out based upon the Key Field (company, since the distribution is connected to the SSC Summary).  By connecting the e-mail distribution as shown below, I've found that though this process, if there wasn't a file created for company B (Fort Smith), an e-mail is not generated for that particular company.  Since I have this process set up as monitored, I move the input file (adding month-day-year-second to the file name) when the process is finished.  This not only keeps your input file safe from being written over, it also does not allow server updates to accidentally set the monitored process off by accident.

 

In other processes where they're ran once a day, the month, day, year macros suffice to create unique files.  However, in this case, I had to use a field within my report, that would be different from the next run, to make the naming unique.

 

I hope someone may find this helpful.

 

imageimageimageimage

Tagged: