Add Trend Tag to existing/previous trend view [Citect Scada 2018 SA]

Hi,

The Default Info_Trend page, will upon click on the marked button show the tag in a new Process Analyst window. 

I would like to make similar button that will add the Equipment Trend tag to the existing/previous trend view that the user had open. 

Appreciate any suggestions how to assign such an button, what functions would I need to set up etc. ?

Thanks,

Rune

Parents
  • Hi Rune,

    Change the for loop in: "TrendPage_ShowForEquipment" as follows:

    FOR iTrace = 0 TO nTraceCount - 1 DO
    sItem = ArrayGetString(hTraces, iTrace, g_iTraceDataItem);
    sTag = ArrayGetString(hTraces, iTrace, g_iTraceDataTag);
    nTraceType = ArrayGetInt(hTraces, iTrace, g_iTraceDataTraceType);
    nPenType = ArrayGetInt(hTraces, iTrace, g_iTraceDataPenType);
    nAlarmType = ArrayGetInt(hTraces, iTrace, g_iTraceDataAlarmType);

    sPenName = _TrendPage_GetPenName(sCluster, sEquipment, sItem);

    sTraceKeyTest = _TrendPage_GetTraceKey(sPenName, nTraceType);

    // Only add the trace if it does not already exist
    IF (NOT MapKeyExists(sActiveTraceMap, sTraceKeyTest)) THEN
    _TrendPage_AddTrendToPA(sPenName, nTraceType, sTag, nPenType, nAlarmType);

    // Need to manually update active trace map as PenCreated is suppressed
    sTraceKey = _TrendPage_GetTraceKey(sPenName, nTraceType);
    MapValueSet(sActiveTraceMap, sTraceKey, 0);
    ELSE
    nSkippedTraces = nSkippedTraces + 1;
    END
    END

    Next modify the _TrendPage_UpdateEquipmentTraceCount call after the for loop to:

    // Need to manually update active equipment count as PenCreated is suppressed
    _TrendPage_UpdateEquipmentTraceCount(hSelectedEquipment, nTraceCount - nSkippedTraces);

    Lastly, make sure you create two local variables to the function:
    INT nSkippedTraces = 0;
    STRING sTraceKeyTest;

    With the earlier changes to not clear the pens and the above, you will now be able to additively add pens.
    Don't forget to add protection to this function to not exceed "l_nMaxActiveTraces". Add a msgbox to be nice to operator when that occurs. There are two situations to take care of:
    1. You are already at max active traces and therefore no traces were added
    2. current + new traces will yield only some of the traces are added.

    cheers,

    bradley
Reply
  • Hi Rune,

    Change the for loop in: "TrendPage_ShowForEquipment" as follows:

    FOR iTrace = 0 TO nTraceCount - 1 DO
    sItem = ArrayGetString(hTraces, iTrace, g_iTraceDataItem);
    sTag = ArrayGetString(hTraces, iTrace, g_iTraceDataTag);
    nTraceType = ArrayGetInt(hTraces, iTrace, g_iTraceDataTraceType);
    nPenType = ArrayGetInt(hTraces, iTrace, g_iTraceDataPenType);
    nAlarmType = ArrayGetInt(hTraces, iTrace, g_iTraceDataAlarmType);

    sPenName = _TrendPage_GetPenName(sCluster, sEquipment, sItem);

    sTraceKeyTest = _TrendPage_GetTraceKey(sPenName, nTraceType);

    // Only add the trace if it does not already exist
    IF (NOT MapKeyExists(sActiveTraceMap, sTraceKeyTest)) THEN
    _TrendPage_AddTrendToPA(sPenName, nTraceType, sTag, nPenType, nAlarmType);

    // Need to manually update active trace map as PenCreated is suppressed
    sTraceKey = _TrendPage_GetTraceKey(sPenName, nTraceType);
    MapValueSet(sActiveTraceMap, sTraceKey, 0);
    ELSE
    nSkippedTraces = nSkippedTraces + 1;
    END
    END

    Next modify the _TrendPage_UpdateEquipmentTraceCount call after the for loop to:

    // Need to manually update active equipment count as PenCreated is suppressed
    _TrendPage_UpdateEquipmentTraceCount(hSelectedEquipment, nTraceCount - nSkippedTraces);

    Lastly, make sure you create two local variables to the function:
    INT nSkippedTraces = 0;
    STRING sTraceKeyTest;

    With the earlier changes to not clear the pens and the above, you will now be able to additively add pens.
    Don't forget to add protection to this function to not exceed "l_nMaxActiveTraces". Add a msgbox to be nice to operator when that occurs. There are two situations to take care of:
    1. You are already at max active traces and therefore no traces were added
    2. current + new traces will yield only some of the traces are added.

    cheers,

    bradley
Children
No Data