# Scanning labels for data entry

**URL:** <https://forum.inductiveautomation.com/t/scanning-labels-for-data-entry/106290>\
**Category:** Ignition\
**Tags:** perspective, ignition81, scripting\
**Created:** [May 15, 2025, 8:41am UTC](https://forum.inductiveautomation.com/t/scanning-labels-for-data-entry/106290 "2025-05-15T08:41:35Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![Anthony\_Ortiz](https://avatars.discourse-cdn.com/v4/letter/a/e9bcb4/32.png) [@Anthony\_Ortiz](https://forum.inductiveautomation.com/u/Anthony_Ortiz)\
**Post date:** [May 15, 2025, 8:41am UTC](https://forum.inductiveautomation.com/t/scanning-labels-for-data-entry/106290/1 "2025-05-15T08:41:36Z")

</div>

I need to be able to scan labels with barcodes and fill in label values on a Perspective view. Label 1 shows the format of our labels and the data they contain. Label 2 gives a bit more detailed info; the final image is a simplified sketch of our Perspective view layout.

On Label type 1 I have three barcodes

Using an iPad, I can scan each barcode individually and get the raw values shown next to each barcode but can’t get the Best by Date as there is no barcode for that.

On Label type 2 (GS1-128) I have a single barcode

Using the iPad, I can scan the GS1-128 label and get the UPC, Best by Date and Batch number but I cannot scan the Material number as there is no barcode for that.

GS1-128 Label gives the raw data shown in image Label2

_**]C1010006548798744617250906100012300123**_

Part 1”]C1” is the GS1-128 code ID

Parts 2, 4 and 6 are CODE-128 App IDs

“01” = GTIN-14 or our UPC code represented by 14 digits

“17” = Expiration Date or Best by Date or Enjoy by Date shown as 6 digits YYMMDD

“10” = Batch Number shown as 10 digits

Parts 3, 5 and 7 are the App IDs values.

“00065487987446” is the UPC number

“250906” is the Best by Date

“0012300123” is the batch number

I can scan the GS1-128 label, send the raw data to a PLC. Concat the data there then send it back to three ignition object tags to fill UPC, Best by Date, and Batch fields. I cannot fill in the Mat number field. I can only have one barcode script for project session event.

Is there a way to get all the data from a single scan of either label? What am I missing? What would be the best way to continue?

NOTE: I use the PLC to concat the data because I am new to ignition. Any scripting advice is very welcome. We are just beginning to use Ignition and I don't have very much to reverse engineer. I have been reading the forums and manuals for a few days now and I am slowly learning.

 ![Labels1](https://us1.discourse-cdn.com/inductiveautomation/original/3X/4/9/4943c1258423864dd9dbfb1dfc76d4baf30d28fd.jpeg)

 ![Labels2](https://us1.discourse-cdn.com/inductiveautomation/original/3X/7/4/74ccc2257c8baca531b3df37678202a4086ff179.jpeg)

 ![PerspectiveView1](https://us1.discourse-cdn.com/inductiveautomation/original/3X/4/8/48eb5a3a64515e056267d6a8c542b59d0416f09d.jpeg)

Tags: iPad IOS Android Mobile Camera Tablet Multiple Barcode Scan GS1-128

---

<div class="post-metadata">

**Author:** ![David\_Stone](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/david_stone/32/79749_2.png) [@David\_Stone](https://forum.inductiveautomation.com/u/David_Stone)\
**Post date:** [May 15, 2025, 9:08am UTC](https://forum.inductiveautomation.com/t/scanning-labels-for-data-entry/106290/2 "2025-05-15T09:08:43Z")

</div>

Forgetting for a second about the how to transform the data bit, the UPC code is unique to the material is it not? So you can load the UPC numbers in a database and just look up the material number via the UPC number to get the correct material to display?

---

<div class="post-metadata">

**Author:** ![Anthony\_Ortiz](https://avatars.discourse-cdn.com/v4/letter/a/e9bcb4/32.png) [@Anthony\_Ortiz](https://forum.inductiveautomation.com/u/Anthony_Ortiz)\
**Post date:** [May 15, 2025, 9:21am UTC](https://forum.inductiveautomation.com/t/scanning-labels-for-data-entry/106290/3 "2025-05-15T09:21:30Z")

</div>

That may be correct. I am not sure so I will look into in.

---

<div class="post-metadata">

**Author:** ![David\_Stone](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/david_stone/32/79749_2.png) [@David\_Stone](https://forum.inductiveautomation.com/u/David_Stone)\
**Post date:** [May 15, 2025, 9:34am UTC](https://forum.inductiveautomation.com/t/scanning-labels-for-data-entry/106290/4 "2025-05-15T09:34:04Z")

</div>

I have done a bunch of stuff with the GS1-128 barcodes, Ignition makes it really easy to do string manipulation. One particular tool you can use is python scripting like so:

```python

barcode = "]C1010006548798744617250906100012300123"
codeID = barcode[0:2] #this will grab the characters from position 0 to position 2 and put them in codeID
upcCode = barcode[5:19] #same thing but for the UPC
bestBefore = barcode[21:27]
batchNo = barcode[29:40]

print codeID
print upcCode
print bestBefore
print batchNo

```

You can run this in the script console to play around with it. It can be inserted in a binding to grab the barcode and return only one of the values to feed one of your elements on screen.

Once you have these values, you can play with running queries on the database using them pretty easily.

---

<div class="post-metadata">

**Author:** ![Anthony\_Ortiz](https://avatars.discourse-cdn.com/v4/letter/a/e9bcb4/32.png) [@Anthony\_Ortiz](https://forum.inductiveautomation.com/u/Anthony_Ortiz)\
**Post date:** [May 19, 2025, 4:54am UTC](https://forum.inductiveautomation.com/t/scanning-labels-for-data-entry/106290/5 "2025-05-19T04:54:50Z")

</div>

Thank you David, that is pretty much what I did in the plc. I can usually fix syntax issues and figure out the needed code, but knowing where it goes is issue. If I were to put this in the UPC binding as you say, it doesn't work or I get syntax errors.

Here is my Session Event for barcode script

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

Here is my view

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

Script Version Raw Binding, the other bindings are the same tag binding.

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

Up to this point, everything works except the values that show "null".  
I tried adding your script to the session barcode event but it does nothing. I also tried adding them to the individual tag binding scripts but it gives syntax or character errors. I understand what your script does, I'm just not sure how to (or where) use it.

Respectfully,  
Anthony

---

<div class="post-metadata">

**Author:** ![Leor\_Fishman](https://avatars.discourse-cdn.com/v4/letter/l/e19adc/32.png) [@Leor\_Fishman](https://forum.inductiveautomation.com/u/Leor_Fishman)\
**Post date:** [May 19, 2025, 5:04am UTC](https://forum.inductiveautomation.com/t/scanning-labels-for-data-entry/106290/6 "2025-05-19T05:04:02Z")

</div>

you can use an expression binding, something like [substring | Ignition User Manual](https://www.docs.inductiveautomation.com/docs/8.1/appendix/expression-functions/string/substring) applied to barcode.value

---

<div class="post-metadata">

**Author:** ![Anthony\_Ortiz](https://avatars.discourse-cdn.com/v4/letter/a/e9bcb4/32.png) [@Anthony\_Ortiz](https://forum.inductiveautomation.com/u/Anthony_Ortiz)\
**Post date:** [May 19, 2025, 5:05am UTC](https://forum.inductiveautomation.com/t/scanning-labels-for-data-entry/106290/7 "2025-05-19T05:05:54Z")

</div>

I am also trying that but i still get errors

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

---

<div class="post-metadata">

**Author:** ![Leor\_Fishman](https://avatars.discourse-cdn.com/v4/letter/l/e19adc/32.png) [@Leor\_Fishman](https://forum.inductiveautomation.com/u/Leor_Fishman)\
**Post date:** [May 19, 2025, 5:06am UTC](https://forum.inductiveautomation.com/t/scanning-labels-for-data-entry/106290/8 "2025-05-19T05:06:28Z")

</div>

get rid of the term before the equals sign -- expressions don't need assignment

---

<div class="post-metadata">

**Author:** ![Anthony\_Ortiz](https://avatars.discourse-cdn.com/v4/letter/a/e9bcb4/32.png) [@Anthony\_Ortiz](https://forum.inductiveautomation.com/u/Anthony_Ortiz)\
**Post date:** [May 19, 2025, 5:10am UTC](https://forum.inductiveautomation.com/t/scanning-labels-for-data-entry/106290/9 "2025-05-19T05:10:02Z")

</div>

Tried that as well right before you suggested it lol

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

---

<div class="post-metadata">

**Author:** ![Leor\_Fishman](https://avatars.discourse-cdn.com/v4/letter/l/e19adc/32.png) [@Leor\_Fishman](https://forum.inductiveautomation.com/u/Leor_Fishman)\
**Post date:** [May 19, 2025, 5:10am UTC](https://forum.inductiveautomation.com/t/scanning-labels-for-data-entry/106290/10 "2025-05-19T05:10:32Z")

</div>

ohhhh, i see the issue. change the sidebar from tag binding to expression binding

---

<div class="post-metadata">

**Author:** ![Anthony\_Ortiz](https://avatars.discourse-cdn.com/v4/letter/a/e9bcb4/32.png) [@Anthony\_Ortiz](https://forum.inductiveautomation.com/u/Anthony_Ortiz)\
**Post date:** [May 19, 2025, 5:14am UTC](https://forum.inductiveautomation.com/t/scanning-labels-for-data-entry/106290/11 "2025-05-19T05:14:58Z")

</div>

Thank you. that worked perfectly.

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

Is there a way to be able to scan other tag types? Right now the session scan is only going to work for GS1-128. I am hoping to get the material number as well. Can I scan an image with the tablet camera and it get the Material number text and convert it to serial and the the GS1-128 barcode? The material number is the last part of this task. The labels at the top are the ones I have to work with.

---

<div class="post-metadata">

**Author:** ![Leor\_Fishman](https://avatars.discourse-cdn.com/v4/letter/l/e19adc/32.png) [@Leor\_Fishman](https://forum.inductiveautomation.com/u/Leor_Fishman)\
**Post date:** [May 19, 2025, 5:17am UTC](https://forum.inductiveautomation.com/t/scanning-labels-for-data-entry/106290/12 "2025-05-19T05:17:42Z")

</div>

hmmm, that one i'm not sure about. Maybe something with PyTesseract for OCR?

---

<div class="post-metadata">

**Author:** ![Anthony\_Ortiz](https://avatars.discourse-cdn.com/v4/letter/a/e9bcb4/32.png) [@Anthony\_Ortiz](https://forum.inductiveautomation.com/u/Anthony_Ortiz)\
**Post date:** [May 19, 2025, 5:18am UTC](https://forum.inductiveautomation.com/t/scanning-labels-for-data-entry/106290/13 "2025-05-19T05:18:23Z")

</div>

I will look into it, again, thank you.
