Hello guys. I have the following message in an alarm notification pipeblock however the split function does not seem to be working. i assume i have the wrong syntax. any inputs?
Alarm {name} transitioned to {eventState} at {eventTime|hh:mm:ss}. The display path is {displayPathOrSource}. The machine is {displayPathOrSource}.split('/')[7]
This looks like you're mixing expression and script.
.split()
is a python/jython method on strings.
expressions do have an equivalent, also called split:
https://docs.inductiveautomation.com/display/DOC81/split
ok. i changed it but its the same. But you can see in the image the split string function is still not working
Alarm {name} transitioned to {eventState} at {eventTime|hh:mm:ss}. The display path is {displayPathOrSource}. The spread is split(toString({displayPathOrSource}),"/")[7,0]
I think you actually can't use expressions in the notification block.
Here's what I can suggest: Add a script block just before your notification block, with this code:
event['pathOrSource'] = event['displayPathOrSource'].split('/')[7]
then use {pathOrSource}
instead of displayPathOrSource
in your message.
1 Like