# Tag placeholders

**URL:** <https://forum.inductiveautomation.com/t/tag-placeholders/8117>\
**Category:** Ignition\
**Created:** [March 7, 2014, 11:13am UTC](https://forum.inductiveautomation.com/t/tag-placeholders/8117 "2014-03-07T11:13:45Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![chelton](https://avatars.discourse-cdn.com/v4/letter/c/e8c25b/32.png) [@chelton](https://forum.inductiveautomation.com/u/chelton)\
**Post date:** [March 7, 2014, 11:13am UTC](https://forum.inductiveautomation.com/t/tag-placeholders/8117/1 "2014-03-07T11:13:45Z")

</div>

Looking for guidance, first time user.

I have created global modules getBit() and setBit() as below:

def getBit(value, position):  
return (value \>\> position) & 1

def setBit(value, position, newValue):  
newValue = (newValue & 1) \<\< position  
mask = 1 \<\< position  
return (value & ~mask) | newValue

I want to create a pop-up control with Test/Run Start/Stop buttons that uses a single INT tag for control/status

On a pop-up window is there a way to pass a tag to the getBit / setBit global script when I call the pop-up? Is there a placeholder that I can use? I have tried adding a custom property “ControlTag” to the root container of the pop-up then on a button on the mouse released event trying:  
app.bit.setBit({Root Container.ControlTag}, 1, 1) but get an error.

Is there a better way to accomplish this?

---

<div class="post-metadata">

**Author:** ![zackscriven](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/zackscriven/32/7213_2.png) [@zackscriven](https://forum.inductiveautomation.com/u/zackscriven)\
**Post date:** [March 23, 2014, 6:34pm UTC](https://forum.inductiveautomation.com/t/tag-placeholders/8117/2 "2014-03-23T18:34:29Z")

</div>

Why not have 4 SQLTags inside of Ignition that each reference a different Bit inside of that Integer. I believe that would make scripting and project design easier.

---

<div class="post-metadata">

**Author:** ![chelton](https://avatars.discourse-cdn.com/v4/letter/c/e8c25b/32.png) [@chelton](https://forum.inductiveautomation.com/u/chelton)\
**Post date:** [March 24, 2014, 2:00am UTC](https://forum.inductiveautomation.com/t/tag-placeholders/8117/3 "2014-03-24T02:00:03Z")

</div>

Unfortunately I’m communicating with an omron plc using modbus. The omron modbus does not support function 0x02 or 0x16. So I cannot write to bits of a word, and it appears I have to have a write tag and a read tag for bit addresses, which gets ugly pretty quickly when you have a number of toggle type commands.

---

<div class="post-metadata">

**Author:** ![adamaustin](https://avatars.discourse-cdn.com/v4/letter/a/5f8ce5/32.png) [@adamaustin](https://forum.inductiveautomation.com/u/adamaustin)\
**Post date:** [March 24, 2014, 4:38pm UTC](https://forum.inductiveautomation.com/t/tag-placeholders/8117/4 "2014-03-24T16:38:44Z")

</div>

You could try using [system.tag.read](http://www.inductiveautomation.com/support/usermanuals/ignition/system_tag_read.htm):

```auto
def getBit(tag, position):
	value = system.tag.read(tag).value
	return (value >> position) & 1

def setBit(tag, position, newValue):
	value = system.tag.read(tag).value
	newValue = (newValue & 1) << position
	mask = 1 << position
	return (value & ~mask) | newValue 
```

mouseClicked:

```auto
sTag = system.gui.getParentWindow(event).rootContainer.ControlTag
system.tag.write(sTag, app.bit.setBit(sTag, 1, 1))
```
