Custom display path in Alert using script

Hi!

I have 150 instances of a UDT and I have configured the alert property of the tags within the UDT.
The display path of the alert is, by default is the actual tag path.

Is there any way through which a script can be linked to the display path of the alert ?

I would like to do this because, the display path (which by default is the tag path), should be something else that would give a hint to the operator about the physical location of the problem.
I can derive this from the tag path, using a script, but i couldn’t link a script to the display path in the alert property of the UDT tag.
I could manually change the diplay path for 150 tags but that would consume lots of effort and time, moreover changes would again take a lot of time.

Looking forward to a solution.

The best way to do this is to create a Parameter in the UDT and set the alarms Display Path to that parameter. Of course you’ll still stuck entering in 150 different parameter values, but it is cleaner than overriding each individual UDT Display Value. :/ I don’t think it’s possible to reference anything other than parameters within the UDT.

For future reference - I always create a UDTCommon data type and use that as the parent of all my UDT’s. It has some common parameters like name, shortName, opcPath, udtPath. Then I set the Display Path of my alarms to {name}. The UDTCommon also has Memory Tags like Name, ShortName, OPCPath, UDTPath and their values set to reference the matching parameter. So I’ll have a parameter called name and a memory tag called Name. The memory tag’s value is set to {name}. This allows me to get the parameter value out of the UDT since you can’t directly reference a UDT parameter in development.

i tried the following script, but i couldn’t get the desired result.

def alarmdat(): import system data1 = system.alert.queryAlertStatus(Flatten = 1,ActiveAndUnacked = 1, ActiveAndAck = 1) data = system.datasetToPyDataSet(data1) desc = ['A','B'] q = len(data) for j in range(q): disp = data[j][2] item = 'ABC' total = item,disp r = system.dataset.setvalue(data1,j,2,total) return r

then i linked the dataset of the alarm summary as follows:

runScript("app.alarm.alarmdat()", 1000)

the display path didn’t change :frowning:

The script doesn’t work because you are using the data1 dataset inside the system.dataset.setValue function which never changes. You need to use data1 throughout instead of r:def alarmdat(): import system data1 = system.alert.queryAlertStatus(Flatten = 1,ActiveAndUnacked = 1, ActiveAndAck = 1) data = system.datasetToPyDataSet(data1) desc = ['A','B'] q = len(data) for j in range(q): disp = data[j][2] item = 'ABC' total = item,disp data1 = system.dataset.setvalue(data1,j,2,total) return r

I replaced r with data1 through out. But it still displayed the default display path.

In my UDT i had linked the alert display path to the instance number, which i added as a parameter in the UDT and configured it to hold the instance number. I did this because it would be easier for me to use that display path to generate my required display path.

I replaced r with data1 through out. But it still displayed the default display path.
Looking forward to a solution…

That should work. Put a print statement in to make sure it is updating the cell:... total = item,disp data1 = system.dataset.setvalue(data1,j,2,total) print total print data1.getValueAt(j,2) .....

it doesn’t not work if i link it to the dataset of the alarm summary table. When i click on the dataset it shows a list that contains the modified display path, however the alarm summary table display path does not change.
When i link this to a simple table it works, but with the alarm summary table it doesn’t…

Is it possible for you to post a small example illustrating the problem? That way I can look at it and possibly fix it.