Você está na página 1de 15

Batch Script Creation and

Execution

Copyright © 2016 Duck Creek Technologies . All Rights Reserved. Confidential and Proprietary Information.
Content

• Overview
• Request Structure
• Creating Batch Script
• Option Tag Child Elements
• Batch Script Example

• Batch Script Execution

Copyright © 2016 Duck Creek Technologies . All Rights Reserved. Confidential and Proprietary Information. 2
Overview

Batch processing allows you to generate and execute script files that can perform mass
operations (such as delete, renew or expire policies) on policies, files or messages in the
EXAMPLE Data database in an unattended manner.
In Duckcreek we achieve this using predefined server request “BatchProcess.processRq” which
allow batch processing of Server requests

Copyright © 2016 Duck Creek Technologies . All Rights Reserved. Confidential and Proprietary Information. 3
Request Structure

The request used to start batch processing where the batch script is passed in as part of the
request.
<BatchProcess.processRq>

<Query />

<PreExecute />

<Execute />

<PostExecute />

</BatchProcess.processRq>

Copyright © 2016 Duck Creek Technologies . All Rights Reserved. Confidential and Proprietary Information. 4
Creating Batch Script

The Child Elements of Batch Script process are explained below:


• Query
Query tag is having two sections <Option> and <SessionLoadType>
– Option
option tag contains query definition settings which define the policies or messages to
be included in the batch script, basically this part includes main logic to implement
action on a set of policies which satisfies a condition.
– SessionLoadType
The contents of this element should contain a format string that will have the values
of the Sql defined in the Option block substituted into it Defines how a particular
session is loaded based on policies selected in query, so this tag is feeder for
Execute tag to perform action on what all is loaded in SessionLoadtype

Copyright © 2016 Duck Creek Technologies . All Rights Reserved. Confidential and Proprietary Information. 5
Option Tag Child Elements
<Option>

<Sql db="" dsn=“" uid="" pwd=“” timeoutSeconds=“30"> </Sql>

<Layout>

<Field value="” >

</Layout>

</Option>

Note: The SQL tag also has an optional attribute called ‘timeoutSeconds’, its
important mention this in case we are trying to run long running queries using batch
script
• Sql
Provides the sql string as well as the information for the database to query.

Copyright © 2016 Duck Creek Technologies . All Rights Reserved. Confidential and Proprietary Information. 6
Option Tag Child Elements (Cont..)

• Layout

Copyright © 2016 Duck Creek Technologies . All Rights Reserved. Confidential and Proprietary Information. 7
Creating Batch Script (Cont..)

PreExecute
Executed before Execute tag and only once irrespective of number of records
selected in process
Execute
Executed after pre-execute and before post-execute, it’s executed once for every
record query tag returns, so we need to take extra care of the field/file we are calling
in Execute tab as it will impact all the policies returned by ‘query’ tag.
PostExecute
Executed after Execute tag and only once irrespective of number of records selected
in process

Copyright © 2016 Duck Creek Technologies . All Rights Reserved. Confidential and Proprietary Information. 8
Batch Script Example
<server>
<requests>
<Session.loginRq userName="admin" password="admin"/>
<BatchProcess.processRq>
<Query>
<Option>
<Sql db="prompt" dsn="ExampleData" uid="DCTSqlUser" pwd="orange#5">{0}</Sql>
<Layout >
<Field value="select q.QuoteID,h.HistoryID,address from Quote q inner join History h on q.QuoteID = h.QuoteID where
q.Status='Quote' and q.ExpirationDate is not null and q.ExpirationDate &lt;&gt; '' and DATEDIFF (day,q.ExpirationDate,GETDATE()) = ‘0' and h.DuplicateRow=0 and (h.Deleted is null or h.Deleted='0') and
h.Type='New'" />
</Layout>
</Option>
<SessionLoadType>
<OnlineData.loadPolicyRq policyID="{0}" />
<OnlineData.loadHistoryRq historyID="{1}" />

</SessionLoadType>
</Query>
<PreExecute>
<requests />
</PreExecute>
<Execute>
<requests>
<ManuScript.getValueRq manuscript="Carrier_AutomatedProcess_Expire" field="data.ProcessCheck" />
</requests>
</Execute>
<PostExecute>
<requests />
</PostExecute>
</BatchProcess.processRq>
<Session.closeRq/>
</requests>
</server>

Copyright © 2016 Duck Creek Technologies . All Rights Reserved. Confidential and Proprietary Information. 9
Using Batch Script Editor

Copyright © 2016 Duck Creek Technologies . All Rights Reserved. Confidential and Proprietary Information. 10
Batch Script Execution

Prerequisite
Make sure DSN is configured with SQL authentication (in case we are accessing
SQL tables in batch process)
Navigation: Control Panel-> Administrative Tools->Data Source-> System DSN

Copyright © 2016 Duck Creek Technologies . All Rights Reserved. Confidential and Proprietary Information. 11
Batch Script Execution (cont..)

Execution of batch script includes 2 steps


1. Create executable file
To run request without human interaction we make use of batch file (.bat). A batch
file is script file which consists of a series of commands to be executed by the
command-line interpreter, stored in a plain text file.
Example:
echo on
"C:\Program Files\Duck Creek Technologies\Util\PostRequest.exe" /s:"http://localhost:8080/DuckCreek/DCTServer.aspx" /rf:"C:\Program Files\Duck Creek
Technologies\BatchScript\QuoteExpiration.xml"
pause
@if "%ERRORLEVEL%" == "0" goto good
:fail
EXIT /B 1
:good
EXIT /B 0
echo ************* DONE BatchExec *******************************

Note: /s: “server”, /rf: “run the content for request file”

Copyright © 2016 Duck Creek Technologies . All Rights Reserved. Confidential and Proprietary Information. 12
2. Now add the batch file in task scheduler and mention the trigger condition and
describe schedule timings

Copyright © 2016 Duck Creek Technologies . All Rights Reserved. Confidential and Proprietary Information. 13
Questions ?

Copyright © 2016 Duck Creek Technologies . All Rights Reserved. Confidential and Proprietary Information. 14
Thank You !!!!

Copyright © 2016 Duck Creek Technologies . All Rights Reserved. Confidential and Proprietary Information. 15

Você também pode gostar