Announcement

Collapse
No announcement yet.

Write ET Global variables to log

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Write ET Global variables to log

    I've got an event that triggers when a device in a group changes value, works great.

    In that event I'm able to successfully send the ET global variables in an email.

    When I try to write those same variables to HS4 log in an immediate script in the same event, I'm getting compilation errors. The WriteLog script works fine if I take out the ET global variables.

    Code:
    &nhs.WriteLogEx ("Alarm", $$GLOBALVAR:ETDeviceName: & " in " & $$GLOBALVAR:ETDEviceLocation1: & " is " & $$GLOBALVAR:ETDeviceStatus:, "#FF0000")
    What am I doing wrong?

    #2
    You cannot use global variables directly in scripts.

    You have to use the scripting command hs.ReplaceVariables to 'extract' the value i.e.

    Code:
     &nhs.WriteLogEx("Alarm", hs.ReplaceVariables("$$GLOBALVAR:ETDeviceName:") & " in " & hs.ReplaceVariables("$$GLOBALVAR:ETDEviceLocation1:") & " is " & hs.ReplaceVariables("$$GLOBALVAR:ETDEviceLocation1:"), "#FF0000")
    Jon

    Comment


      #3
      I did not know about the hs.ReplaceVariables function, works like a charm!

      You once again saved the day, thanks Jon!

      Comment

      Working...
      X