# Perspective step counter

**URL:** <https://forum.inductiveautomation.com/t/perspective-step-counter/54883>\
**Category:** Ignition\
**Created:** [January 11, 2022, 4:03pm UTC](https://forum.inductiveautomation.com/t/perspective-step-counter/54883 "2022-01-11T16:03:26Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Christopher\_Smith](https://avatars.discourse-cdn.com/v4/letter/c/ce7236/32.png) [@Christopher\_Smith](https://forum.inductiveautomation.com/u/Christopher_Smith)\
**Post date:** [January 11, 2022, 4:03pm UTC](https://forum.inductiveautomation.com/t/perspective-step-counter/54883/1 "2022-01-11T16:03:26Z")

</div>

I am using a button to increase a step count in Perspective. What I want to do is take a tag value, use the button to increment the value and then write the new value to the tag. I have been trying to do this but the tag value keeps coming up as a string and I cannot change it to an integer. I got around this issue in Vision by creating a custom tag on the view and linking it to the tag and using that, but it does not seem to be working in Perspective. I’m sure there is a better way. my script is below.  
value = event.source.parent.StepNumber  
value = value + 1  
system.tag.writeBlocking([’[default]Process\_Step.value’], [value])

---

<div class="post-metadata">

**Author:** ![Troy](https://avatars.discourse-cdn.com/v4/letter/t/85f322/32.png) [@Troy](https://forum.inductiveautomation.com/u/Troy)\
**Post date:** [January 11, 2022, 4:33pm UTC](https://forum.inductiveautomation.com/t/perspective-step-counter/54883/2 "2022-01-11T16:33:21Z")

</div>

I don’t think you need “.value” in the tag path.  
Assuming `event.source.parent.StepNumber` returns an integer and the tag you’re writing to holds a string value, this might work:

```auto
system.tag.writeBlocking(['[default]Process_Step'], [str(value)])

```

If StepNumber is a string, you need to cast it as an integer before adding to it:

```auto
value = int(event.source.parent.StepNumber)

```

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [January 11, 2022, 4:46pm UTC](https://forum.inductiveautomation.com/t/perspective-step-counter/54883/3 "2022-01-11T16:46:00Z")

</div>

Is the datatype of your tag `int` ?

```python
type(system.tag.readBlocking(["[]Test"])[0].value)

```

gives me `int` if the datatype of the tag is `int`.  
Can you try this and check if it matches the configuration of your tag ?

---

<div class="post-metadata">

**Author:** ![Christopher\_Smith](https://avatars.discourse-cdn.com/v4/letter/c/ce7236/32.png) [@Christopher\_Smith](https://forum.inductiveautomation.com/u/Christopher_Smith)\
**Post date:** [January 11, 2022, 4:46pm UTC](https://forum.inductiveautomation.com/t/perspective-step-counter/54883/4 "2022-01-11T16:46:54Z")

</div>

Yes this worked. I just found how to do that here:  
[https://docs.inductiveautomation.com/display/DOC80/Reading+and+Writing+to+Tags](https://docs.inductiveautomation.com/display/DOC80/Reading+and+Writing+to+Tags)  
Thank you.
