You are on page 1of 5

Example for file handling:

The file poller waits for the new_orders_file to be updated. As soon as an update is detected, BW starts a process that
creates an empty approval file and then uses the ship_to_address to calculate the shipping costs (by calling a sub-process).
The process then waits for the empty approval file to be updated. Finally, a file is written (customer_notification) that gives
the customer the relevant shipping information.
By default, the filenames are defined as global variables. If you want to change these defaults, you should:
Click on Edit -> Global Variables to display the list of currently configured global variables
Modify BW_new_order_file to point to the XML file that contains the new order details and triggers the process. The default
value is c:\temp\BW_new_order.xml
Modify BW_shipping_costs. This file should contain the shipping costs information. The default value is
c:\temp\BW_shipping_costs.xml
Modify BW_customer_notification. This file will be created by BW to notify the customer of the complete shipping details.
The default is c:\temp\BW_customer_notification.txt
Modify BW_approval_file. This file will be created by BW and the user should enter the approval status. The default is
c:\temp\BW_approval_file.txt

The File Poller process starter polls for files or directories with the given name and starts a process when the specified
change (creation, modification, deletion) is detected.
File Name:You can also use wildcards to monitor a directory for files that match the given specification. For example,
C:\files\*.log would match any change to a file in the files directory with an extension of .log
Polling interval (in seconds) to check for the specified file.
Include Existing Files:When this field is checked, if an existing file matches the specification in the File Name field when a
process engine starts, then a new process instance is created. If this field is not checked, any existing files that match the
specification in the File Name field are ignored until there is a change in the file. If this field is not checked, any existing files
that match the specification in the File Name field are ignored until there is a change in the file.
Exclude File Content: Specifies not to load the data from the file into this activitys output. If this check box is selected, the
contents of the file are not available to subsequent activities in the process definition.
Sort By:Files are processed as the polling interval occurs. Therefore, the Sort By field applies to all files that have changed
since the last polling interval. The Sort By field can be very useful if you wish to process files in a specific order when the
process engine starts and the Include Existing Files field is checked (then all existing files are processed in the specified
order).
Note: The File Poller starts process instances based on the specified Sort By order, but the process instances may not
complete in the same order. If you wish to guarantee that processes start and complete in a given order, you must specify
Max Jobs = 1 and enable the Activatation Limit field when you deploy your project.
The Parse XML activity takes a binary XML file or an XML string and processes it, turning it into an XML schema tree
based on the XSD or DTD specified.
The preferred way to parse XML files is to use a Read File activity set to binary mode to read the XML file. Then pass the
binary file contents to the Parse XML activity.

The Render XML activity takes an instance of an XML schema element and renders it as a stream of bytes containing XML or an XML string. The schema is
processed based on the XSD file specified

The Wait for File Change activity waits for a file creation, modification, or deletion event to occur during process execution.
When this activity is executed, the process instance suspends and waits for the specified change to occur before resuming.
Candidate Event Key:Expression built from the data of the incoming file change event. This expression should evaluate to
a string and it is compared to the "key" field of the activitys input. If the Candidate Event Key and the activitys key match,
then the process accepts the incoming file change event.
You should specify the contains(pfx2:EventSourceOuputTextClass/fileContent/textContent,
"approved") or contains(pfx2:EventSourceOuputTextClass/fileContent/textContent,
"delayed")for the Candidate Event Key field, and you should specify "true" for the "key" field on the Input tab.

concat($Parse-new-order-file/order/customer_name, ",&lf;Your order has been ", $Wait-for-Approval-FileChange/pfx2:EventSourceOuputTextClass/fileContent/textContent,"&lf;The cost is as follows, &lf;Purchase cost
: $", $Parse-new-order-file/order/total_price, "&lf;Shipping costs : $", $Calculate-Shipping-cost/shipping_costs,
"&lf;Total Cost : $", $Parse-new-order-file/order/total_price + $Calculate-Shipping-cost/shipping_costs)
T

You might also like