批量新增普通点

Navigation:  Python > TagMgr类管理 > tagmgr模块 >

批量新增普通点

Previous pageReturn to chapter overviewNext page

 

方法定义

 

add_tags(self, props)

 

 

方法参数说明

参数名称

参数说明

参数类型

默认值

props

多个点属性列表,列表元素为每个点的属性字典。

例如:

[{'tagname': 'tag0','tagtype': 'int32'},

{'tagname': 'tag1','tagtype': 'int32'}]

字典类型的list

 

 

异常

 

如果调用失败,抛出hyperdb.HDError异常

 

返回值

 

hyperdb.hd_sucess

 

方法调用

 

def AddTags(self):

   attr = [{'tagname': 'tag_int16_30', 'tagtype': 'int8'},

       {'tagname': 'tag_int16_31', 'tagtype': 'int8'},

       {'tagname': 'tag_int16_32', 'tagtype': 'int8'},

       {'tagname': 'tag_int16_33', 'tagtype': 'int8'},

       {'tagname': 'tag_int16_34', 'tagtype': 'int8'},

       {'tagname': 'tag_int16_35', 'tagtype': 'int8'},

       {'tagname': 'tag_int16_36', 'tagtype': 'int8'},

       {'tagname': 'tag_int16_37', 'tagtype': 'int8'},

       {'tagname': 'tag_int16_38', 'tagtype': 'int8'},

       {'tagname': 'tag_int16_39', 'tagtype': 'int8'}]

   try:

       self.myTagMgr.add_tags(attr)

   except Exception as e:

       print("add_tags error: ", e.errcode)

   else:

       print("adding tags succeeds")