User Defined Function - Best Practice

Hi All,

I’m creating some functions that split a string out into categories and then break those categories into buckets. They are all identical from the category level down, so I’m using a UDT. I currently have all of my functions in a Project Script called ‘speedway’, so I should be able to access those functions by calling them with project.speedway.function(). This works in the script editor but once I put the function call in a ‘Value Changed’ Tag Event, it starts getting wacky and unreliable.

Is it better to define a function inside of the Value Changed script or is what I’m doing okay and there’s just a way to make it more reliable?

Thanks in advance!

EDIT: I will add that it could come from my UDT structure and the way that I’m entering arguments for the function. I have two parameters in my UDT, Antenna Number and Reader Number, both are integer values. When I call the function ( antenna_hold() ) in the Value Changed, I format the call like this:

project.speedway.antenna_hold("[.]Reader", "[.]Antenna")

I’m not sure if there’s a better way to use the UDT parameters. Right now I’s done via two expression tags, Reader and Antenna that take the value of Antenna Number and Reader Number UDT parameters.

Tag events cannot call project scripts. Only shared scripts are available. Consider (strongly!) using a gateway tag change events (in the project) instead.

1 Like

Got it, thanks.

What about using UDT parameters in a function call? Is that possible? It doesn’t like when I call my ‘Antenna Number’ parameter using the typical {Antenna Number} format.