Write Tag Array
Home Product
Details Free 
Demo Pricing &
Ordering Related
Products Support About Us

Please use our Code Center to obtain source-code and example projects/solutions:

http://codecenter.softwaretoolbox.com

 

Web Based Applications using the OPC Web Client Web Service

Objective

    To write values to a Tag array from a webpage.

    This example assumes that you have the Software Toolbox TOPServer installed, and the default project "simdemo.opf" is loaded within the TOPServer.

Source code

    JAVASCRIPT

<html>
<head>
<title>OPC Web Client running in IE, using OPC Web Client WEB SERVICE</title>
<SCRIPT LANGUAGE="JScript" src="ArgumentFormat.js"></SCRIPT>
<script language="javascript">

function fnInit()
{
   provider.init();
}

function fnWriteResult()
{
   if(event.error)
   {
       alert('error' + event.errorMessage);
   }
   else
   {
       alert('Write success!');
   }
}

function btnWrite_click()
{
   var arrValues = document.all.tagvalue.value.split(",");
   provider.write({ServerClass: "SWToolbox.TOPServer", ItemID: "Channel_1.Device_1.TagArray_1", Value: arrValues});
}

</script>
</head>

<body onload="fnInit();">
<DIV id="service" style="behavior:url(webservice.htc)"></DIV>
<DIV id="provider" style="behavior:url(eagateway.htc)" webService="service" onWriteResult="fnWriteResult()"></DIV>
<p>OPC Server: SWToolbox.TOPServer -with modified &quot;simdemo.opf&quot; project
   loaded.<br>
<b>Tag Values to write:</b>
<input type="text" name="tagvalue" value="1, 2, 3, 4, 5, 6, 7, 8, 9, 10" size="25" readonly="readonly">
<input type="button" name="b1" value="write" onClick="btnWrite_click();">
</p>
</body>


</html>

Copyright Software Toolbox, Inc., 1996-2004, All Rights Reserved Worldwide.
148A East Charles Street, Matthews, North Carolina, USA 28105
Phone: 704-849-2773 or 1-888-665-3678 (US), Fax: 704-849-6388
sales@softwaretoolbox.com | support@softwaretoolbox.com