Script Console Browse for Tag Providers

HI,

I use the following code to browse for a list of tag providers:

def getProviders():
	providers = system.tag.browse('')
	targetProviders = []
	for provider in providers.getResults():
		targetProviders.append(provider['name'])
	
	return targetProviders

This works when tag change script or a Perspective session calls this, but doesn’t when called from the script console.

I need to use this for some tag maintenance where I browse the gateway and search for some issues.

Any reason why it doesn’t work from the designer script console context and is there an alternative way of getting a list of all providers?

Regards,
Deon

Hi,
i use this code inside a button… i don’t know if useful for you

context = event.source.getAppContext()

provs = []
tm = context.getTagManager()
provprops = tm.getProviderProperties()
for p in provprops:
	provs.append(p.getName())
 
print provs
1 Like

Hi

Do you know how to get provs list in perspective session?
There is no event.source.getAppContext in perspective

It was quicker to make a list by hand.

My automated tag maintenance scripts run on tag change events, so there the blank browse technique still works.

I’m interested in the solution, though.

Perspective scripts run in the gateway, so you’d need the GatewayContext (aka IgnitionGateway) instead of the VisionClientContext you get from a component. The rest would be the same.

1 Like

Thanks Phil