Add a Custom Script
Previous Topic  Next Topic 


Overview


Script Source can be to used to get data from a file, a database, or some other ‘non standard’ format.  The script source will be treated like any other polling source, DataXchange will run the script on the polling interval set. The script will do whatever it is scripted to do to retrieve and parse data and populate variables that can then be used in DataXchange expressions.  


Adding a Custom Script Variable


In order to create a valid Custom Script you need to create the name of the variable itself.  This can be done by navigating to the DataXchange tab and selecting the Variable drop down and choose Script.



Once there, you will need to Add a new name and description for Source Variable.  It is a good idea to have the name resemble the functionality of the written script.  



The Next thing you will need to do is create a communication method to the C# written script for the equipment.

       -  This can be done under the DataXchange tab, select the machine that you would like to configure and then click Communication.



Now, you will need to create a connection string to the C# written script within DataXchange.

       - Click Add



The custom script communicates as a data source only.  From the Communication Role drop down select Source and for the Communication Type select Script. 



You will then need to designate the Script Path to the location where the C# script is located.  You can do this by selecting the Browse button.



Now that the script has been selected you are ready to go.  Once the Custom Script is used within an expression it will run the C# script you have written and return the desired value back.