I don't know if you've received a satisfactory response or found help elsewhere, but at the risk of exposing my clumsy python skills, I'll share some code I wrote to create some tags. This same code can also be used to overwrite existing tags because of the "o" collision policy option. Another useful collision policy option would be "m" for editing tags.
The scenario is this:
I have a database full of some 30 columns worth of data for 4 different kilns. I want access to about 29 of those values in my applications. I have a single query tag that retrieves [4R x 30C] for a total of 120 discrete values into a dataset. Although I could theoretically use values directly out of that tag, the addressing would be a nightmare, especially for anyone coming behind me. I would much rather have 116 intuitively named tags with a single value for use in my application so I chose to make expression tags that pull their values out of the aforementioned dataset tag. This keeps the traffic to the database at a minimum.
That's a lot of copying and pasting with 115 chances to make an error or I can just write code to do it and they will all be perfect. Here is the code:
tg = "FiveSecondLeased"
tt = "AtomicTag"
vs = "expr"
dt = "Float4"
be = "{[.]KilnLiveDataVW}[kkkk,'ffff']"
bn = "Kilnkkkkffff"
fl = ['RunID','Sch','TimeDate','Hours','TargMC','MeasMC','AveTdal','SchDBstpt','AveDB','SchWBstpt','AveWB','MC_1','MC_2','MC_3','MC_4','MC_5','MC_6','FanFwd','FanSpd','AveEnt','LVent','RVent','KilnDmd','TotDmd','BlrFlow','StmPres','Amps1','Amps2','t_stamp']
ft = ["Integer","String","DateTime","Float4","Float4","Float4","Float4","Float4","Float4","Float4","Float4","Float4","Float4","Float4","Float4","Float4","Float4","Boolean","Short","Float4","Short","Short","Integer","Integer","Integer","Float4","Float4","Float4","DateTime"]
path = "[v8Provider]Kiln"
tgs = []
for k in range(1,5):
i = -1
for fld in fl:
i += 1
tag = {
"valueSource": "expr"
,"expression": be.replace("kkkk",str(k-1)).replace("ffff",fld)
,"dataType": ft[i]
,"name": bn.replace("kkkk",str(k)).replace("ffff",fld)
,"tagGroup":tg
,"tagType":tt
}
# print cfg,'\r\n\r\n',pp,'\r\n',tagtgs.append(tag1)
tgs.append(tag)
print tgs
system.tag.configure(path,tgs,"o")
This code only runs the one time in a script console window so there is no harm in sprinkling in some print statements in there for ease of debugging. Voila. 116 tags from a single query to a database.
Can any other SCADA platform do that?