# Qr scann multiple objects

**URL:** <https://community.thunkable.com/t/qr-scann-multiple-objects/1036644>\
**Category:** Questions about Thunkable X\
**Created:** [December 15, 2020, 5:15pm UTC](https://community.thunkable.com/t/qr-scann-multiple-objects/1036644 "2020-12-15T17:15:07Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![gsolis2753g](https://avatars.discourse-cdn.com/v4/letter/g/5daacb/32.png) [@gsolis2753g](https://community.thunkable.com/u/gsolis2753g)\
**Post date:** [December 15, 2020, 5:15pm UTC](https://community.thunkable.com/t/qr-scann-multiple-objects/1036644/1 "2020-12-15T17:15:07Z")

</div>

Hi im trying to scan multiple objects in the same scann or maiby make a loop for the scann call but when i try to stop it the app companion crash here are my blocks atm.

 ![Screenshot_1](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/1/8/1874cfcec2ef6a55c87735a12573809441e3c554.png)

the idea is after one scann is completed save this value to a list (this function properly) and the start then scan again to scan another object.

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [December 15, 2020, 5:20pm UTC](https://community.thunkable.com/t/qr-scann-multiple-objects/1036644/2 "2020-12-15T17:20:40Z")

</div>

Instead of a timed loop, use a recursive function.

```auto
function "scan"
     Barcode scanner1 call Scan
     then do
          [blocks]
          scan

```

The “then do” part of the block will make sure the current scan has completed before attempting the next scan. The “scan” function call at the end will restart the process.

In your when “Button2 Click” block, you just need a single block: “scan”.

---

<div class="post-metadata">

**Author:** ![gsolis2753g](https://avatars.discourse-cdn.com/v4/letter/g/5daacb/32.png) [@gsolis2753g](https://community.thunkable.com/u/gsolis2753g)\
**Post date:** [December 15, 2020, 5:52pm UTC](https://community.thunkable.com/t/qr-scann-multiple-objects/1036644/3 "2020-12-15T17:52:58Z")

</div>

let me test this, hope this works tnx

---

<div class="post-metadata">

**Author:** ![gsolis2753g](https://avatars.discourse-cdn.com/v4/letter/g/5daacb/32.png) [@gsolis2753g](https://community.thunkable.com/u/gsolis2753g)\
**Post date:** [December 15, 2020, 6:44pm UTC](https://community.thunkable.com/t/qr-scann-multiple-objects/1036644/4 "2020-12-15T18:44:56Z")

</div>

so this let me scann multiple objects at the time but when i need to stop (cancel button) it crash de  
companion

 ![Screenshot_2](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/d/f/dfeb52b11460a53f1c1002de5b668851bb91d239.png)  
i was thinking on work whit the “was cancelled” value any sugestions ??

---

<div class="post-metadata">

**Author:** ![gsolis2753g](https://avatars.discourse-cdn.com/v4/letter/g/5daacb/32.png) [@gsolis2753g](https://community.thunkable.com/u/gsolis2753g)\
**Post date:** [December 15, 2020, 7:26pm UTC](https://community.thunkable.com/t/qr-scann-multiple-objects/1036644/5 "2020-12-15T19:26:24Z")

</div>

i get it right mi error was cause because when i press cancel button i dont get the “value back” so crash the copanion i add a little if and the problem was solve ty for the first part

 ![Screenshot_3](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/2/0/2076fa47b26946f6455962430d6d02f8572f47ee.png)

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [December 15, 2020, 10:00pm UTC](https://community.thunkable.com/t/qr-scann-multiple-objects/1036644/6 "2020-12-15T22:00:14Z")

</div>

Glad to hear you got it working! Yes, you always want to check the value of any green “error” or “was cancelled” blocks. If you try to access list data or data sources and the value is null or empty, your app may crash.

---

<div class="post-metadata">

**Author:** ![ioannis](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/ioannis/32/146956_2.png) [@ioannis](https://community.thunkable.com/u/ioannis)\
**Post date:** [November 8, 2024, 12:19pm UTC](https://community.thunkable.com/t/qr-scann-multiple-objects/1036644/7 "2024-11-08T12:19:42Z")

</div>


