# Looping through a local DB

**URL:** <https://community.thunkable.com/t/looping-through-a-local-db/1179941>\
**Category:** Questions about Thunkable X\
**Tags:** beginner\
**Created:** [March 22, 2021, 5:56am UTC](https://community.thunkable.com/t/looping-through-a-local-db/1179941 "2021-03-22T05:56:41Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![p.powercoders1i0t](https://avatars.discourse-cdn.com/v4/letter/p/f07891/32.png) [@p.powercoders1i0t](https://community.thunkable.com/u/p.powercoders1i0t)\
**Post date:** [March 22, 2021, 5:56am UTC](https://community.thunkable.com/t/looping-through-a-local-db/1179941/1 "2021-03-22T05:56:41Z")

</div>

I’m trying to loop through a local DB, I want to get property objects for object j. I tried doing this:

Edit:  
Sorry wrong screenshot  
 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/f/b/fbcff83fff9edf43d00c137ab9ca29f8d0e31ecd.png)

But the data returns nothing, any advice?

Local DB Image:

![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/f/4/f4f94bd39eab15fcff6ace4920b4b94fd1ca2545.png)

---

<div class="post-metadata">

**Author:** ![codeswept](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/codeswept/32/87755_2.png) [@codeswept](https://community.thunkable.com/u/codeswept)\
**Post date:** [March 22, 2021, 5:57am UTC](https://community.thunkable.com/t/looping-through-a-local-db/1179941/2 "2021-03-22T05:57:22Z")

</div>

Can you share an screenshot of your DB? As far as I can see, you’ve done it wrong. Firstly, you’re looping through the Profile Pictures of the homework helpers. Change that to ID.

---

<div class="post-metadata">

**Author:** ![codeswept](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/codeswept/32/87755_2.png) [@codeswept](https://community.thunkable.com/u/codeswept)\
**Post date:** [March 22, 2021, 6:02am UTC](https://community.thunkable.com/t/looping-through-a-local-db/1179941/3 "2021-03-22T06:02:14Z")

</div>

There’s more wrong too, but I can only explain that after you’ve shared a screenshot of your DB.

---

<div class="post-metadata">

**Author:** ![p.powercoders1i0t](https://avatars.discourse-cdn.com/v4/letter/p/f07891/32.png) [@p.powercoders1i0t](https://community.thunkable.com/u/p.powercoders1i0t)\
**Post date:** [March 22, 2021, 6:03am UTC](https://community.thunkable.com/t/looping-through-a-local-db/1179941/4 "2021-03-22T06:03:35Z")

</div>

thanks! The pictures in the post.

---

<div class="post-metadata">

**Author:** ![codeswept](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/codeswept/32/87755_2.png) [@codeswept](https://community.thunkable.com/u/codeswept)\
**Post date:** [March 22, 2021, 6:07am UTC](https://community.thunkable.com/t/looping-through-a-local-db/1179941/5 "2021-03-22T06:07:02Z")

</div>

Instead of  
 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/0/8/0891d20aa8603cd33c56691f0c14d1d1806ea650.png)

Use  
 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/9/9/9997f58dfbf7de60bc4a6a7eff727767f0499bb1.png)  
Of course, my table names are wrong- replace them with your table names and column names.

---

<div class="post-metadata">

**Author:** ![p.powercoders1i0t](https://avatars.discourse-cdn.com/v4/letter/p/f07891/32.png) [@p.powercoders1i0t](https://community.thunkable.com/u/p.powercoders1i0t)\
**Post date:** [March 22, 2021, 6:07am UTC](https://community.thunkable.com/t/looping-through-a-local-db/1179941/6 "2021-03-22T06:07:57Z")

</div>

Something like this? And thank you for the help!

![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/0/4/047d1fc4c052a233546b759b0507bf926b4c818c.png)

---

<div class="post-metadata">

**Author:** ![codeswept](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/codeswept/32/87755_2.png) [@codeswept](https://community.thunkable.com/u/codeswept)\
**Post date:** [March 22, 2021, 6:08am UTC](https://community.thunkable.com/t/looping-through-a-local-db/1179941/7 "2021-03-22T06:08:08Z")

</div>

Also, do the same with  
 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/5/b/5b0cea879afc72b8557e84061becf70e6c0862c8.png)

---

<div class="post-metadata">

**Author:** ![codeswept](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/codeswept/32/87755_2.png) [@codeswept](https://community.thunkable.com/u/codeswept)\
**Post date:** [March 22, 2021, 6:09am UTC](https://community.thunkable.com/t/looping-through-a-local-db/1179941/8 "2021-03-22T06:09:41Z")

</div>

Yep, that’s right. Can you test it an tell me?

---

<div class="post-metadata">

**Author:** ![p.powercoders1i0t](https://avatars.discourse-cdn.com/v4/letter/p/f07891/32.png) [@p.powercoders1i0t](https://community.thunkable.com/u/p.powercoders1i0t)\
**Post date:** [March 22, 2021, 6:14am UTC](https://community.thunkable.com/t/looping-through-a-local-db/1179941/9 "2021-03-22T06:14:30Z")

</div>

It works!

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/a/9/a9e5d4e8aa4052dc039b335327420cb02aa0119e.png)

I was using the Gmail API to send an email within the app (Tutorial from cttricks: [Sending Emails From Thunkable App | Gmail App](https://community.thunkable.com/t/sending-emails-from-thunkable-app-gmail-app/497195))

It works fine now! Thanks for the help!

---

<div class="post-metadata">

**Author:** ![codeswept](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/codeswept/32/87755_2.png) [@codeswept](https://community.thunkable.com/u/codeswept)\
**Post date:** [March 22, 2021, 6:16am UTC](https://community.thunkable.com/t/looping-through-a-local-db/1179941/10 "2021-03-22T06:16:16Z")

</div>

Great work! I’d love to try this out myself!

---

<div class="post-metadata">

**Author:** ![p.powercoders1i0t](https://avatars.discourse-cdn.com/v4/letter/p/f07891/32.png) [@p.powercoders1i0t](https://community.thunkable.com/u/p.powercoders1i0t)\
**Post date:** [March 22, 2021, 6:18am UTC](https://community.thunkable.com/t/looping-through-a-local-db/1179941/11 "2021-03-22T06:18:16Z")

</div>

Sure! I’ll send a link!

---

<div class="post-metadata">

**Author:** ![codeswept](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/codeswept/32/87755_2.png) [@codeswept](https://community.thunkable.com/u/codeswept)\
**Post date:** [March 22, 2021, 6:19am UTC](https://community.thunkable.com/t/looping-through-a-local-db/1179941/12 "2021-03-22T06:19:19Z")

</div>

Thanks!

---

<div class="post-metadata">

**Author:** ![p.powercoders1i0t](https://avatars.discourse-cdn.com/v4/letter/p/f07891/32.png) [@p.powercoders1i0t](https://community.thunkable.com/u/p.powercoders1i0t)\
**Post date:** [March 22, 2021, 6:42am UTC](https://community.thunkable.com/t/looping-through-a-local-db/1179941/13 "2021-03-22T06:42:42Z")

</div>

Alright, my computer was being slow, but here’s a mock up version!: [Thunkable](https://x.thunkable.com/copy/4d20e77c087fab244fa735cd094f6f07)

---

<div class="post-metadata">

**Author:** ![p.powercoders1i0t](https://avatars.discourse-cdn.com/v4/letter/p/f07891/32.png) [@p.powercoders1i0t](https://community.thunkable.com/u/p.powercoders1i0t)\
**Post date:** [March 22, 2021, 6:46am UTC](https://community.thunkable.com/t/looping-through-a-local-db/1179941/14 "2021-03-22T06:46:28Z")

</div>

Oh yeah I forgot to mention: It’s being sent from my teams email if you want it to be sent from an email of your choice head over to the tutorial!

---

<div class="post-metadata">

**Author:** ![codeswept](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/codeswept/32/87755_2.png) [@codeswept](https://community.thunkable.com/u/codeswept)\
**Post date:** [March 22, 2021, 6:49am UTC](https://community.thunkable.com/t/looping-through-a-local-db/1179941/15 "2021-03-22T06:49:53Z")

</div>

Wow! This is amazing! I just tested it out, and it worked great. Will check out the tutorial. Sorry, I tested it and got an email from your team’s email.

---

<div class="post-metadata">

**Author:** ![p.powercoders1i0t](https://avatars.discourse-cdn.com/v4/letter/p/f07891/32.png) [@p.powercoders1i0t](https://community.thunkable.com/u/p.powercoders1i0t)\
**Post date:** [March 22, 2021, 6:52am UTC](https://community.thunkable.com/t/looping-through-a-local-db/1179941/16 "2021-03-22T06:52:33Z")

</div>

Glad to hear it worked and that you liked it!!

And thanks to @cttricks for the awesome tutorial 🙂

---

<div class="post-metadata">

**Author:** ![codeswept](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/codeswept/32/87755_2.png) [@codeswept](https://community.thunkable.com/u/codeswept)\
**Post date:** [March 22, 2021, 6:53am UTC](https://community.thunkable.com/t/looping-through-a-local-db/1179941/17 "2021-03-22T06:53:18Z")

</div>

Could you share the APPSCRIPT code if you don’t mind? The link to @cttricks’s code isn’t working.

---

<div class="post-metadata">

**Author:** ![p.powercoders1i0t](https://avatars.discourse-cdn.com/v4/letter/p/f07891/32.png) [@p.powercoders1i0t](https://community.thunkable.com/u/p.powercoders1i0t)\
**Post date:** [March 22, 2021, 6:55am UTC](https://community.thunkable.com/t/looping-through-a-local-db/1179941/18 "2021-03-22T06:55:28Z")

</div>

sure, pretty sure this was it …

```
function doPost(e) {

  var recipient = e.parameters.recipient;
    recipient = decodeURI(recipient);
  var subject = e.parameters.subject;
    subject = decodeURI(subject);
  var body = e.parameters.body;
    body = decodeURI(body);

  MailApp.sendEmail(recipient, subject, body);
}
```

---

<div class="post-metadata">

**Author:** ![codeswept](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/codeswept/32/87755_2.png) [@codeswept](https://community.thunkable.com/u/codeswept)\
**Post date:** [March 22, 2021, 6:55am UTC](https://community.thunkable.com/t/looping-through-a-local-db/1179941/19 "2021-03-22T06:55:47Z")

</div>

Thank you so much! Am trying this myself right now.

---

<div class="post-metadata">

**Author:** ![p.powercoders1i0t](https://avatars.discourse-cdn.com/v4/letter/p/f07891/32.png) [@p.powercoders1i0t](https://community.thunkable.com/u/p.powercoders1i0t)\
**Post date:** [March 22, 2021, 6:56am UTC](https://community.thunkable.com/t/looping-through-a-local-db/1179941/20 "2021-03-22T06:56:56Z")

</div>

awesome! Let me know if I could help with anything else

[Next page](https://community.thunkable.com/t/looping-through-a-local-db/1179941.md?page=2)
