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.

Parents
  • 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.

Reply
  • 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.

Children
No Data