Extract number out of tag to use in calculated roster

FaultedTank = event["TankNum"]
data = system.db.runPrepQuery("SELECT X.contact, UserData.username FROM (SELECT * from UserContact) as X LEFT OUTER JOIN UserData ON X.user_id = UserData.id WHERE UserData.id IN (SELECT user_id FROM Tank where Tank_Number = ?) ", [FaultedTank])
	
for row in data:  
    builder.username(row["username"]).email([row["contact_value"]]).add()
 
userList = builder.build()
return userList
2 Likes

Ah right. Just the question mark for the ‘variable’! Thanks!

1 Like

Hi

Thank you, I still get errors: after change this can you guide where i am missing
Unable to parse calculated roster.
Roster '<calculated>' has no users, notification for 1 alarm will go undelivered.

Well the script you put in the calculated roster panel seems to be returning an empty list.
We can't help you without seeing your code.