0% found this document useful (0 votes)
57 views

Tech Note 1003 - Accessing InBatch Recipes in System Platform Using Recipe Automation Server Object Hosted On Batch Server Node

This document provides instructions for accessing InBatch recipes in System Platform using a Recipe Automation Server object hosted on a Batch server node. It describes importing a script function library, instantiating a template object, hosting it on the Batch server node, and setting a trigger attribute. When triggered, the script will connect to the Recipe Automation Server, retrieve recipes, log the names, and release the database connection. Logger messages confirm connectivity and list the retrieved recipes.

Uploaded by

profilemail8
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
57 views

Tech Note 1003 - Accessing InBatch Recipes in System Platform Using Recipe Automation Server Object Hosted On Batch Server Node

This document provides instructions for accessing InBatch recipes in System Platform using a Recipe Automation Server object hosted on a Batch server node. It describes importing a script function library, instantiating a template object, hosting it on the Batch server node, and setting a trigger attribute. When triggered, the script will connect to the Recipe Automation Server, retrieve recipes, log the names, and release the database connection. Logger messages confirm connectivity and list the retrieved recipes.

Uploaded by

profilemail8
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Accessing InBatch Recipes In System Platform Using Recipe Automation Server (Object Hosted on Batch Server Node)

Tech Note 1003


Accessing InBatch Recipes In System Platform Using Recipe Automation Server (Object Hosted on
Batch Server Node)

All Tech Notes, Tech Alerts and KBCD documents and software are provided "as is" without warranty of any kind. See the Terms of Use for more information.

Topic#: 002834
Created: January 2014

Introduction
This Tech Note demonstrates the syntax used for the Recipe Object creation/release in a .NET Framework environment.

In this scenario, a Platform is deployed to an InBatch Server Node and the object containing script for accessing InBatch Recipes is
hosted to this platform. The other functionality on reading/writing to the InBatch Recipe Database is documented in InBatch COM Guide.

Application Versions
InBatch 9.x & 10.x

System Platform 2012 R2 (for prior versions, you have to manually build the object)

Prerequisites
A platform must be deployed to the InBatch Server Node.

Procedure
1. From the Archestra IDE menu, select Galaxy\Import\Script Function Library and import the file RecipeEdit.exe located at
C:\Program files(x86)\Wonderware\inBatch\Bin on InBatch Server Node.

2. Import the $InBatchRecipeDBAccess template aaPkg to the IDE.

3. Create an instance of this object and host it to the Platform\AppEngine\Area that is running on InBatch Server Node.

4. Deploy the new object instance and set the trigger attribute (me.Trigger) in ObjectViewer for this object.

See the messages in the Archestra Logger for successful connectivity, query of recipes and release of the recipeDB object.

The following graphics show the Template Object Editor, with the text in the script body (Figure 1 below), and the messages in
ArchestrA Logger (Figure 2 below).

file:///C|/inetpub/wwwroot/t002834/t002834.htm[1/13/2014 10:30:58 AM]


Accessing InBatch Recipes In System Platform Using Recipe Automation Server (Object Hosted on Batch Server Node)

file:///C|/inetpub/wwwroot/t002834/t002834.htm[1/13/2014 10:30:58 AM]


Accessing InBatch Recipes In System Platform Using Recipe Automation Server (Object Hosted on Batch Server Node)

FIGuRE1: ENSuRE tHE ScRIpt RuNS ASYNcHRONOuSLY

The following section contains the script (if you using a prior version of System Platform 2012 R2, copy the following text and paste it to
your object, then declare variables in the declaration section as shown in Figure 1 (above).

'script globals and Trigger is a Boolean UDA


me.Trigger = false;
iConnected = 0;
i = 1;
'-----------------------------------------------------------------------------
'Recipe Automation Server - localhost
'-----------------------------------------------------------------------------
LogMessage("***Recipe Automation Server*** [localhost]");
'Creating and allocating memory to RecipeDB Object
oRecipeDB = NEW RecipeEditLib.wwRecipe();
'Object creation test
IF oRecipeDB == NULL THEN
LogMessage("oRecipeDB create failed";
ENDIF;
'Get recipes
aRecipes = oRecipeDB.GetRecipes;
'Connection test
IF aRecipes == NULL
THEN iConnected = 0;
LogMessage("oRecipeDB connection state: Not connected " + iConnected);
ELSE iConnected = 1;
LogMessage("oRecipeDB connection state: Connected " + iConnected);
ENDIF;
FOR i = aRecipes.GetLowerBound(0) to aRecipes.GetUpperBound(0)
LogMessage(" Recipe[" + i + "]: " + aRecipes.GetValue(i));
NEXT;
'note - to prevent multiple copies, shutdown recipe server
LogMessage("***Recipe Automation Server*** release");
IF oRecipeDB <> NULL
THEN System.Runtime.InteropServices.Marshal.ReleaseComObject( oRecipeDB );
oRecipeDB = NULL;
ENDIF;
'------------------------------------------------

file:///C|/inetpub/wwwroot/t002834/t002834.htm[1/13/2014 10:30:58 AM]


Accessing InBatch Recipes In System Platform Using Recipe Automation Server (Object Hosted on Batch Server Node)

FIGuRE 2: LOGGER MESSaGES

S. Mariyala

Tech Notes are published occasionally by Wonderware Technical Support. Publisher: Invensys Systems, Inc., 26561 Rancho Parkway South, Lake Forest, CA 92630. There is also
technical information on our software products at Wonderware Technical Support.

For technical support questions, send an e-mail to [email protected].

Back to top

©2014 Invensys Systems, Inc. All rights reserved. No part of the material protected by this copyright may be reproduced or utilized in any form or by any means, electronic or
mechanical, including photocopying, recording, broadcasting, or by any information storage and retrieval system, without permission in writing from Invensys Systems, Inc.
Terms of Use.

file:///C|/inetpub/wwwroot/t002834/t002834.htm[1/13/2014 10:30:58 AM]

You might also like