MEC: Change out file name dynamically

Background

Manipulating the out file name generated by the middle ware is a common scenario. By default file names are generated with a GUID (13a7a838-a706-4273-b190-9d58a79bf04e). It is more practical if the file name is human readable.

Solution

  1. In the Mapper add User function to change the file name. (Note: this function should the last function in the map)
    image
  2. Add similar code to the function. This code set file name to the manifest information of the map.
    1
    2
    3
    4
    5
    6
    String date = new java.text.SimpleDateFormat("yyMMdd").format(new java.util.GregorianCalendar().getTime());
    String time = new java.text.SimpleDateFormat("HHmmss").format(new java.util.GregorianCalendar().getTime());
    
    String fileName  = "EDI_832_OUT_"+ date+time;
    
    setManifestInfo("map:FileName", fileName);
    
  3. Then, configure the relevant Send (in partner agreement) object to take the given file name.
    image
  4. And you are done. !!!

Comments

Popular posts from this blog

IIS 7.5: 401 Unauthorized Access Error (Keep prompting Username/password)

Calculating Elapsed Time Accurately (C#)

Connecting DB2/iSeries From .net Application