Tuesday, 9 April 2013

Dynamically Create Output Directories

There might be situations where we want to place our output files in a directory.

Business Requirement:

Suppose we have a business requirement to group the output files based  on the date they were created ,
how you can configure your workflow to create output directories at run time for your session output file?

Solution:

we can achieve this by configuring the target  Attributes in the session .
While this example creates directories using the date, it can be implemented as per your business requirement.

Observe the screenshot   below



1.We  should check in the  Create Target Directory check box.
2.We should provide Output file directory location.
Here Output file directory location ' $PMTargetFileDir\OutputDir  ' tells the IS to create a Sub Directory with name 'OutputDir' in the  directory $PMTargetFileDir which is a default Target Destination folder.

When you run the workflow you will see your target file created in the  OutputDir .

Well, this is a static way of creating Output directory.

To make this Dynamic, We use workflow parameter, say, $$OutputDir and assign a value to this parameter using the  Assignment task.

Create a Assignment task before the session and name it as  Asgn_OPut_Dir_Name and in User Defined variables section create new variable with name $$OutputDir and assign below expression to it.

SUBSTR(TO_CHAR(SYSDATE),1,2)||'-'||SUBSTR(TO_CHAR(SYSDATE),4,2)||'-'||SUBSTR(TO_CHAR(SYSDATE),7,4)






When you run the workflow the target files will be written in a new folder created each day.


Hope this helps.


3 comments:

  1. Informative post.I got some important suggestion from this blog .Thanks for sharing. Get MORE Inventory Audit | Warehouse Audit | Visibility Audit

    ReplyDelete
  2. This comment has been removed by the author.

    ReplyDelete
  3. I am reading your post from the beginning, it was so interesting to read & I feel thanks to you for posting such a good blog, keep updates regularly.... Duplicate Payment
    Continuous Monitoring
    AR Customer Helpdesk

    ReplyDelete