# Using variables with system.tag.browse

**URL:** <https://forum.inductiveautomation.com/t/using-variables-with-system-tag-browse/90186>\
**Category:** Ignition\
**Tags:** scripting, ignition81\
**Created:** [May 9, 2024, 7:42pm UTC](https://forum.inductiveautomation.com/t/using-variables-with-system-tag-browse/90186 "2024-05-09T19:42:41Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![tim.marbury](https://avatars.discourse-cdn.com/v4/letter/t/f19dbf/32.png) [@tim.marbury](https://forum.inductiveautomation.com/u/tim.marbury)\
**Post date:** [May 9, 2024, 7:42pm UTC](https://forum.inductiveautomation.com/t/using-variables-with-system-tag-browse/90186/1 "2024-05-09T19:42:42Z")

</div>

I am wanting to use the "system.tag.browse" command by passing in a variable into the path. Can this be done? Here is what I have so far but I can't seem to get past the line "tag =system.tag.browse(tagPath)".

```python
for v in range(1,9):
	tagString = '[default]Recipe_Builder/Station_%s/InstructionList'%(v)
	
	for row in range (0,20):
		tagString2 = 'InstructionList_%s_'%(row)
		tagPath = tagString + tagString2
		#print tagPath
		tag = system.tag.browse(tagPath)
		for i in tag.getResults():

```

---

<div class="post-metadata">

**Author:** ![Steve\_Laubach](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/steve_laubach/32/60900_2.png) [@Steve\_Laubach](https://forum.inductiveautomation.com/u/Steve_Laubach)\
**Post date:** [May 9, 2024, 8:03pm UTC](https://forum.inductiveautomation.com/t/using-variables-with-system-tag-browse/90186/2 "2024-05-09T20:03:24Z")

</div>

You can use the second parameter of system.tag.browse to pass in filters. I think that's what you're asking.

An example

```python
return system.tag.browse('[Provider]Devices', {"name":"*Filter*"})

```

It will return all tags in the "Devices" folder that have "Filter" in their name.

Edit:  
Looking at your code I think you might be better served using a template repeater and indirect bindings.

If you copy something from the perspective property editor you can paste it in a text editor to see what the JSON looks like. Then you can create dynamic JSON using a script.

So you can make a template for 1 row on some form of custom data and have it indirect all its bindings from the passed in parameter. Then you can instantiate that template with a flex repeater using a script.

The only time I would recommend using tag browse with this is if you're trying to generate the content based on tags that exist in a location in the tag db which sometimes makes sense to do.

---

<div class="post-metadata">

**Author:** ![tim.marbury](https://avatars.discourse-cdn.com/v4/letter/t/f19dbf/32.png) [@tim.marbury](https://forum.inductiveautomation.com/u/tim.marbury)\
**Post date:** [May 9, 2024, 8:16pm UTC](https://forum.inductiveautomation.com/t/using-variables-with-system-tag-browse/90186/3 "2024-05-09T20:16:14Z")

</div>

I believe this is what I'm looking for. I am wanting to get all the tags that is used in this parent folder "Recipe\_Builder" which I will then use to write a value back to SQL.

```python
for v in range(1,9):
		
	for row in range (0,20):
		
		tag = system.tag.browse('[default]Recipe_Builder/Station_%s/InstructionList/InstructionList_%s_'%(v,row))
		for i in tag.getResults():

```

---

<div class="post-metadata">

**Author:** ![Steve\_Laubach](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/steve_laubach/32/60900_2.png) [@Steve\_Laubach](https://forum.inductiveautomation.com/u/Steve_Laubach)\
**Post date:** [May 9, 2024, 8:19pm UTC](https://forum.inductiveautomation.com/t/using-variables-with-system-tag-browse/90186/4 "2024-05-09T20:19:34Z")

</div>

Oh, you don't have a front end for what you're doing. Yeah, that is probably what you need.

I thought you might be making a recipe editor.

---

<div class="post-metadata">

**Author:** ![tim.marbury](https://avatars.discourse-cdn.com/v4/letter/t/f19dbf/32.png) [@tim.marbury](https://forum.inductiveautomation.com/u/tim.marbury)\
**Post date:** [May 9, 2024, 8:22pm UTC](https://forum.inductiveautomation.com/t/using-variables-with-system-tag-browse/90186/5 "2024-05-09T20:22:29Z")

</div>

That is exactly what I'm making. However we are wanting to capture any changes that are made to the recipes and the date they are made. I am running a query on an SQL database and writing those values to memory tags in Ignition. Once changes have been made, capturing the before and after values and then writing values back to SQL when a "Save" button is pressed.
