# Confused about return an object in a block

**URL:** <https://talk.observablehq.com/t/confused-about-return-an-object-in-a-block/1021>\
**Category:** Help\
**Created:** [July 25, 2018, 3:45am UTC](https://talk.observablehq.com/t/confused-about-return-an-object-in-a-block/1021 "2018-07-25T03:45:26Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![bravadoops](https://avatars.discourse-cdn.com/v4/letter/b/87869e/32.png) [@bravadoops](https://talk.observablehq.com/u/bravadoops)\
**Post date:** [July 25, 2018, 3:45am UTC](https://talk.observablehq.com/t/confused-about-return-an-object-in-a-block/1021/1 "2018-07-25T03:45:26Z")

</div>

I want to use a block to construct an object, like

```auto
data = {
  const cases = xh.getCase({size: 50});
  return cases;
}

```

## It works and return an object like ‘Object {data: Object, warnings: Object}’

But when I want to return ‘data’ field in the block, like `return cases['data']` in the block, it returns undefined.

something strange is when I try to use this object in other cell, like data[‘data’], it works…

so I’m confused why I cannot select the filed I want in the block? I’m new to observable notebook, any suggestion will be useful : )

---

<div class="post-metadata">

**Author:** ![mbostock](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/mbostock/32/9_2.png) [@mbostock](https://talk.observablehq.com/u/mbostock)\
**Post date:** [July 25, 2018, 4:21am UTC](https://talk.observablehq.com/t/confused-about-return-an-object-in-a-block/1021/2 "2018-07-25T04:21:19Z")

</div>

Does xh.getCases return a promise?

If so, try:

```auto
data = (await xh.getCases({size: 50})).data

```

---

<div class="post-metadata">

**Author:** ![bravadoops](https://avatars.discourse-cdn.com/v4/letter/b/87869e/32.png) [@bravadoops](https://talk.observablehq.com/u/bravadoops)\
**Post date:** [July 30, 2018, 3:46am UTC](https://talk.observablehq.com/t/confused-about-return-an-object-in-a-block/1021/3 "2018-07-30T03:46:29Z")

</div>

Hi Mike, thanks for your useful information. The problem was solved.  
Based on your hint, I checked “Introduction to promise” notebook. My understanding is as one promise could be solved in next cell, when I use it in another cell it works
