Get property of advanced alarm tag

I have an advanced alarm tag and am trying to get its configured description, but can't find the right function to call... I've looked all throughout the Alarm cicode functions category, but they all deal with reading stuff when displaying an alarm list via ANs.

I need something like:

`AlarmGetProperty("AlarmTag", "Description")`

For context, this is for displaying alarms on a device popup specific to that device. I've given up trying to use Citect's ridiculously complicated alarm filtering functions... I have enough hair lost to Citect over the years.

Answer: Use alarm properties, e.g. AlarmTag.Name, AlarmTag.Name, AlarmTag.On, etc.

  • Hi Nick,

    I think in your case the best way to do this is by creating a function that populates the alarm information in your popup using the AlmBrowse* functions. You would need to call AlmBrowseOpen with a filter that suits your needs (for example "EQUIPMENT=MyEquip").
    Then loop through the returned recordset and get the configured comment by calling AlmBrowseGetField and specify "ALMCOMMENT" as field name. Do not use "COMMENT" as field name because this will return the user comment, not the configured comment.
  • You don't want to call AlmBrowseOpen from a display expression on a graphics page because it may take some time to look up the information on the alarm server. Here's a sample Cicode function that you can call from the On Page Entry event for the page so it will look up the value as soon as you open the page. Then, it writes the result into a page string (temporary storage) so you can display it easily.

    //Looks up an alarm property and writes it to a page string named <alarmtag>.<alarmfield>
    //Read the value back with PageGetStr()
    FUNCTION AlmPropToPg(STRING sAlarmTag, STRING sAlarmField)
    INT hAlarms;
    STRING sValue;

    hAlarms = AlmBrowseOpen(sAlarmTag, sAlarmField);

    IF hAlarms <> -1 THEN
    AlmBrowseFirst(hAlarms);
    sValue = AlmBrowseGetField(hAlarms, sAlarmField);
    PageSetStr(sAlarmTag + "." + sAlarmField, sValue);
    ELSE
    TraceMsg("AlmPropToPg() Failed to open alarm browse session");
    END
    END

    Here's the command you'd put in the page event command to look up the comment for Loop_4_SP (an alarm tag in the Example project). You can also see the string expression I put on the page to display the value using the PageGetStr() command.

  • Thanks guys, good ideas, however I've just found that I can use the simple alarm properties to get these. I always forget about these in the later versions of Citect.

    E.g.

    Tag.Desc or
    Tag.Name

    "Supported Alarm Properties" topic in the help.