# \[Question\] Barcode scanner

**URL:** <https://forum.inductiveautomation.com/t/question-barcode-scanner/21625>\
**Category:** Ignition Early Access\
**Created:** [December 31, 2018, 9:19am UTC](https://forum.inductiveautomation.com/t/question-barcode-scanner/21625 "2018-12-31T09:19:43Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![joostjojo](https://avatars.discourse-cdn.com/v4/letter/j/ac91a4/32.png) [@joostjojo](https://forum.inductiveautomation.com/u/joostjojo)\
**Post date:** [December 31, 2018, 9:19am UTC](https://forum.inductiveautomation.com/t/question-barcode-scanner/21625/1 "2018-12-31T09:19:43Z")

</div>

I have a button that scans a barcode when i press it because of the Scan barcode event on the onclick event.

Now I have scanned a barcode I want to display this in a label.  
I’ve watched a video from inductive where this was explained and where pointed too the session.props.device.barcodes wich is not available.

I saw something about that the way this was handled is changed but not how we can do it now?

---

<div class="post-metadata">

**Author:** ![brian.mills](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/brian.mills/32/6348_2.png) [@brian.mills](https://forum.inductiveautomation.com/u/brian.mills)\
**Post date:** [January 2, 2019, 3:33pm UTC](https://forum.inductiveautomation.com/t/question-barcode-scanner/21625/2 "2019-01-02T15:33:33Z")

</div>

> [@joostjojo](#):
>
> session.props.device.barcodes

have you tried self.session.props.device.barcodes? I had to do that with some of mine to get it to work

---

<div class="post-metadata">

**Author:** ![mrojas](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mrojas/32/6394_2.png) [@mrojas](https://forum.inductiveautomation.com/u/mrojas)\
**Post date:** [January 2, 2019, 5:42pm UTC](https://forum.inductiveautomation.com/t/question-barcode-scanner/21625/3 "2019-01-02T17:42:51Z")

</div>

We just changed how barcodes are received. Instead of appending to **session.props.device.barcodes** , we’ve added a script in **Perspective \> Session Events** for handling barcodes.

---

<div class="post-metadata">

**Author:** ![brian.mills](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/brian.mills/32/6348_2.png) [@brian.mills](https://forum.inductiveautomation.com/u/brian.mills)\
**Post date:** [January 2, 2019, 7:40pm UTC](https://forum.inductiveautomation.com/t/question-barcode-scanner/21625/4 "2019-01-02T19:40:03Z")

</div>

so would a scripting call for that then be perspective.session.onBarcodeDataRecieved or system.perspective.session.onBarcodeDataRecieved? (Or something else?)

---

<div class="post-metadata">

**Author:** ![brian.mills](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/brian.mills/32/6348_2.png) [@brian.mills](https://forum.inductiveautomation.com/u/brian.mills)\
**Post date:** [January 2, 2019, 10:01pm UTC](https://forum.inductiveautomation.com/t/question-barcode-scanner/21625/5 "2019-01-02T22:01:37Z")

</div>

Any input on when the documentation will be updated with proper calls/other info?

[https://docs.inductiveautomation.com/display/DOC80/Perspective+Session+Event+Scripts](https://docs.inductiveautomation.com/display/DOC80/Perspective+Session+Event+Scripts)

---

<div class="post-metadata">

**Author:** ![joostjojo](https://avatars.discourse-cdn.com/v4/letter/j/ac91a4/32.png) [@joostjojo](https://forum.inductiveautomation.com/u/joostjojo)\
**Post date:** [January 3, 2019, 10:19am UTC](https://forum.inductiveautomation.com/t/question-barcode-scanner/21625/6 "2019-01-03T10:19:10Z")

</div>

I have figured it out and set the onBarcodeDataRecieved event to return the data to a tag.  
Not the way it should be, but for now it works.

---

<div class="post-metadata">

**Author:** ![scicco](https://avatars.discourse-cdn.com/v4/letter/s/e0b2c6/32.png) [@scicco](https://forum.inductiveautomation.com/u/scicco)\
**Post date:** [January 3, 2019, 5:57pm UTC](https://forum.inductiveautomation.com/t/question-barcode-scanner/21625/7 "2019-01-03T17:57:18Z")

</div>

Hi @joostjojo - agreed that this isn’t the way it should be but to get me going can you please provide the script you used in your event? I took a stab at `system.tag.write("[client]Scanned_Barcode", data)` and no luck. I’m guessing I don’t have something right with the data argument.

Thanks

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [January 3, 2019, 5:59pm UTC](https://forum.inductiveautomation.com/t/question-barcode-scanner/21625/8 "2019-01-03T17:59:26Z")

</div>

> [@scicco](#):
>
> I took a stab at system.tag.write("[client]Scanned\_Barcode", data) and no luck. I'm guessing I don't have something right with the data argument.

Perspective doesn't have client tags. Use session properties.

---

<div class="post-metadata">

**Author:** ![scicco](https://avatars.discourse-cdn.com/v4/letter/s/e0b2c6/32.png) [@scicco](https://forum.inductiveautomation.com/u/scicco)\
**Post date:** [January 3, 2019, 7:16pm UTC](https://forum.inductiveautomation.com/t/question-barcode-scanner/21625/9 "2019-01-03T19:16:04Z")

</div>

Thanks @pturmel

Finally got into Perspective yesterday. This is going to take longer than I thought to get my head wrapped around it.

In case it helps any other Perspective noobs out there here is that line of code: `session.custom.Scanned_Barcode = data[‘text’]`

---

<div class="post-metadata">

**Author:** ![joostjojo](https://avatars.discourse-cdn.com/v4/letter/j/ac91a4/32.png) [@joostjojo](https://forum.inductiveautomation.com/u/joostjojo)\
**Post date:** [January 4, 2019, 7:08am UTC](https://forum.inductiveautomation.com/t/question-barcode-scanner/21625/10 "2019-01-04T07:08:55Z")

</div>

Also when writing to tags in perspective you have to provide your tag provider:

system.tag.write("[yourtagprovider]Scanned\_Barcode", data)
