Use the Task Unpacker Object

What is Task Unpacker?

Task Unpacker is an IWS object, which allows you to receive the incoming archive, unzip it and save unzipped files into a temporary folder in outgoing, so that other objects and/or workflows can process them. Supported archive formats include ZIP, TARGZIP, TAR, GZIP.

An important point is that Task Unpacker does not "give" the file to the other objects/workflows. Instead, those other objects/workflows need to "take" the unzipped data from the folder themselves.

 

Setup in a Workflow

Task Unpacker is usually used as the first step of the workflow, immediately after the Begin object. Place a Data object to define the archive filemask which the Unpacker should receive and then place some more Data objects to define the unzipped filemasks and make the following steps address the folder and process unzipped data. This is an an example of a simple workflow, additional workflow pattern choices can be found here.

Example Scenario

We will build a workflow to solve this sample scenario: An archived file containing two data files may arrive at any time. The workflow should unzip it at once and process both files. If one of the files is missing, you want it to continue and the subprocess should not be indefinitely pending, an error should not be displayed and the workflow should report of a success.

On your worksheet, place a Begin object with Bundle-based option enabled. Next put the Task Unpacker object, followed by two Subprocess objects (one for each of the data files) and the End object.
Next, depending on how the data files are to be processed, either simultaneously or one after the other, place your Subprocess objects and use Fork and Join if required and link everything.
For example, if the two file are to be processed one after the other, your workflow would look like this:


And, if the two file are to be processed simultaneously, your workflow would look like this:


In our initial scenario, we have determined to process simultaneous.

The decision on how to process your files should be made depending the specific workflow and files processing needs. It may differ for a different tasks.

Next, double-click the Subprocess object to name them and configure their properties. When you are done, return to the main worksheet.


In our example, the archive is awaited to have a name _test_funds_20150108.zip, for example, with a varying timestamp.
To make the Task Unpacker receive it, a Data object should be placed on the worksheet and its file mask should be defined. Link it with the Task Unpacker afterwards.


The data files inside are going to have the following names: fund_hierarchy_20150108.csv and fund_relations_20150108.xml, for example.
To make the subprocesses work them up, drop two more Data objects (one for each of the data files), define the file masks awaited and link them (you create an incoming link from Task Unpacker to each of Data shapes and then create an outgoing link from Data shapes to the corresponding Subprocess).

Now, your workflow should resemble this:

Task Unpacker Object Example

In our scenario, we stated If one of the files is missing, you want it to continue and the subprocess should not be indefinitely pending, an error should not be displayed and the workflow should report of a success.
To implement this, we should set a condition to execute on the subprocess shapes. Click the Subprocess shape and in its Properties box edit the Condition To Execute field:

Properties - Condition to Execute dialog
EXPR#iif(StringLength(\5C3Aparam_TASK_genericload_unpacker_DataFlowFiles\5C3A)=0,0,iif(Find(\5C3Aparam_TASK_genericload_unpacker_DataFlowFiles\5C3A, 'ISSUER')!=-1,1,0))

See more info on sharing variables in IWS and making up a Condition to Execute here.

This condition is only one of the options, it is not necessary in all cases and should correspond with your task.

Your workflow for this scenario is now complete!

Other Examples

Here is the same workflow as above, except that the files are to be processed one by one instead of simultaneously.


Also, here's an example of a much more detailed workflow that uses Task Unpacker.