# Perspective Barcode Scan context

**URL:** <https://forum.inductiveautomation.com/t/perspective-barcode-scan-context/51596>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [October 4, 2021, 10:07pm UTC](https://forum.inductiveautomation.com/t/perspective-barcode-scan-context/51596 "2021-10-04T22:07:32Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![stevenson](https://avatars.discourse-cdn.com/v4/letter/s/41988e/32.png) [@stevenson](https://forum.inductiveautomation.com/u/stevenson)\
**Post date:** [October 4, 2021, 10:07pm UTC](https://forum.inductiveautomation.com/t/perspective-barcode-scan-context/51596/1 "2021-10-04T22:07:32Z")

</div>

I’m trying to figure an effective way of handling multiple barcode scan events.

I have an embedded view containing a text field + button. What I want to happen is the button is pressed, the camera reads the barcode and the text field displays the scanned barcode.

If there is only 1 instance of that embedded view, I can return the value via message handler or in a custom session property, then bind the text field there.

However if I’m placing the embedded view in a flex repeater, how would I go about getting the barcode value sent to the correct text field? I do have a unique identifier as a parameter on the embedded view, but I can’t bind the barcode scan context property to that id.  
Similar to this:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/c/0/c087b66e5e1cd3863f42d0f956ec696fc6e9b605.png)

Any ideas would be appreciated!

---

<div class="post-metadata">

**Author:** ![stevenson](https://avatars.discourse-cdn.com/v4/letter/s/41988e/32.png) [@stevenson](https://forum.inductiveautomation.com/u/stevenson)\
**Post date:** [October 4, 2021, 10:50pm UTC](https://forum.inductiveautomation.com/t/perspective-barcode-scan-context/51596/2 "2021-10-04T22:50:34Z")

</div>

Never mind found a work around.

Double up the script event of the button to save the identifier in session.custom in a script, then the scan barcode.  
Then from there when the barcode scanned session event is fired, you can read back the above and pair the barcode value with the identifier.

---

<div class="post-metadata">

**Author:** ![andreas](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/andreas/32/18981_2.png) [@andreas](https://forum.inductiveautomation.com/u/andreas)\
**Post date:** [November 23, 2021, 4:29pm UTC](https://forum.inductiveautomation.com/t/perspective-barcode-scan-context/51596/3 "2021-11-23T16:29:33Z")

</div>

Thanks for sharing your solution @stevenson 🙂  
Exactly what I searched the forum for. Works like a charm! 👌🏼

---

<div class="post-metadata">

**Author:** ![George\_El-Hachem](https://avatars.discourse-cdn.com/v4/letter/g/bb73d2/32.png) [@George\_El-Hachem](https://forum.inductiveautomation.com/u/George_El-Hachem)\
**Post date:** [June 23, 2022, 7:27pm UTC](https://forum.inductiveautomation.com/t/perspective-barcode-scan-context/51596/4 "2022-06-23T19:27:48Z")

</div>

Stevenson, do you mind sharing screenshots of what you did? I’m confused from your solution.

---

<div class="post-metadata">

**Author:** ![stevenson](https://avatars.discourse-cdn.com/v4/letter/s/41988e/32.png) [@stevenson](https://forum.inductiveautomation.com/u/stevenson)\
**Post date:** [June 24, 2022, 8:07pm UTC](https://forum.inductiveautomation.com/t/perspective-barcode-scan-context/51596/5 "2022-06-24T20:07:29Z")

</div>

Here’s my button for a barcode scan:  
First script:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/f/4/f449dc20730718baf252e5b3ef04c09ca02608e3.png)  
Scan barcode:  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/3/9/3931891ff608258b8995afdeb52231505fccceff.png)

Session Handler:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/f/3/f37303a15a00ad1d8359f66ebbd10476b1fe6a14.png)

“Barcode1” can be replaced with any unique identifier to handle multiple scan events and fields.  
From there the text field showing the scan value can just be bound to `session.custom.Barcode.Scanned[<identifier>]`

Hope this helps!

---

<div class="post-metadata">

**Author:** ![George\_El-Hachem](https://avatars.discourse-cdn.com/v4/letter/g/bb73d2/32.png) [@George\_El-Hachem](https://forum.inductiveautomation.com/u/George_El-Hachem)\
**Post date:** [June 27, 2022, 12:42pm UTC](https://forum.inductiveautomation.com/t/perspective-barcode-scan-context/51596/6 "2022-06-27T12:42:44Z")

</div>

you’re amazing, thank you so much! Just a quick question. Would this way of setting up the barcodes allow me to connect specific barcodes to specific tags?

---

<div class="post-metadata">

**Author:** ![stevenson](https://avatars.discourse-cdn.com/v4/letter/s/41988e/32.png) [@stevenson](https://forum.inductiveautomation.com/u/stevenson)\
**Post date:** [June 27, 2022, 12:57pm UTC](https://forum.inductiveautomation.com/t/perspective-barcode-scan-context/51596/7 "2022-06-27T12:57:38Z")

</div>

I don’t see why not. You could have a change event script on the session.custom.Barcode object that would write the newly scanned barcode to a tag.

---

<div class="post-metadata">

**Author:** ![George\_El-Hachem](https://avatars.discourse-cdn.com/v4/letter/g/bb73d2/32.png) [@George\_El-Hachem](https://forum.inductiveautomation.com/u/George_El-Hachem)\
**Post date:** [June 27, 2022, 1:05pm UTC](https://forum.inductiveautomation.com/t/perspective-barcode-scan-context/51596/8 "2022-06-27T13:05:02Z")

</div>

Thank you again, I really appreciate it!
