Skip to end of metadata
Go to start of metadata

system.mes.addTagCollectorValue

system.mes.removeTagCollectorValues

system.mes.addTagCollectorValue(equipmentPath, collectorType, key, dateTime, value, updateFollowing)

Let's say you have four values 10, 20, 30, and 40

You call system.mes.addTagCollectorValue() to insert the value 10 between 20 and 30.

If you pass True to updateFollowing your result will be 10, 20, 10, 20, 30

If you pass False your results will be 10, 20, 10, 30, 40

If you want to control the delta that the following were updated to only subtract 7

you would have to do something like the following:

Start with 10, 20, 30, 40

Add 10 between 20 and 30 using update False, making it 10, 20, 10, 30, 40.

Then add the value 3 between 10 and 30 with update following True making it. 10, 20, 10, 3, 27, 37.

Then remove the 3 using system.mes.deleteTagCollectorValue()

Step-by-step guide

(Sorry if the numbers do not match to the dot the explanation before .. (smile))

before 

  1. Add 10 between 20 and 30 using update False, making it 10, 20, 10, 30, 40.

    #https://help.sepasoft.com/docs/display/MHD/system.mes.addTagCollectorValue

    equipmentPath = '[global]\Nuts Unlimited\SiteOne\Cust\Stuff'
    collectorType = 'Equipment Count'
    key = 'Infeed'
    # in this example I KNOW I want to insert something between
    # 2020-12-18 10:06:39 61
    # and
    # 2020-12-18 10:11:19 71
    dateTime = system.date.parse("2020-12-18 10:08:00")
    value = '10'
    updateFollowing = 0

    system.mes.addTagCollectorValue(equipmentPath, collectorType, key, dateTime, value, updateFollowing)



  2. add the value 3 between 10 and 30 with update following True making it. 10, 20, 10, 3, 27, 37

    equipmentPath = '[global]\Nuts Unlimited\SiteOne\Cust\Stuff'
    collectorType = 'Equipment Count'
    key = 'Infeed'
    # in this example I KNOW I want to insert something between
    # 2020-12-18 10:06:39 61
    # and
    # 2020-12-18 10:11:19 71
    dateTime = system.date.parse("2020-12-18 10:09:00")
    value = '5'
    updateFollowing = 1

    system.mes.addTagCollectorValue(equipmentPath, collectorType, key, dateTime, value, updateFollowing)



  3. remove the 3 using system.mes.deleteTagCollectorValue()

    #https://help.sepasoft.com/docs/display/MHD/system.mes.removeTagCollectorValues

    equipmentPath = '[global]\Nuts Unlimited\SiteOne\Cust\Stuff'
    collectorType = 'Equipment Count'
    key = 'Infeed'
    beginDateTime = system.date.parse("2020-12-18 10:09:00")
    endDateTime = system.date.parse("2020-12-18 10:09:00")

    system.mes.removeTagCollectorValues(equipmentPath, collectorType, key, beginDateTime, endDateTime)