# Query for Specific Index Item in A Collection

**URL:** https://community.weweb.io/t/query-for-specific-index-item-in-a-collection/2126
**Category:** How do I?
**Tags:** design
**Created:** [March 27, 2023, 11:16pm UTC](https://community.weweb.io/t/query-for-specific-index-item-in-a-collection/2126 "2023-03-27T23:16:05Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![aherbert](https://avatars.discourse-cdn.com/v4/letter/a/839c29/32.png) [@aherbert](https://community.weweb.io/u/aherbert)
#### Post date: [March 27, 2023, 11:16pm UTC](https://community.weweb.io/t/query-for-specific-index-item-in-a-collection/2126/1 "2023-03-27T23:16:05Z")

</div>

Hello WeWeb Community! Relatively new user here and I’m trying to get a grasp of the No Code features after coming from a code heavy background.

My team and I are trying to see what’s the best way to query/load a specific index item from a collection. Essentially we have a collection of prospects and based on an unique identifier or name, we want to populate a page with their specific details. At the moment, it only seems like we can select an index manually via the Edit Formula menu:

![image](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/a/a6eab469f1a276412a2d3a6a8d4f2bbbb1ba9c75.png)

What’s the best way to do this? Thanks!

---

<div class="post-metadata">

### Author: ![pyee](https://avatars.discourse-cdn.com/v4/letter/p/848f3c/32.png) [@pyee](https://community.weweb.io/u/pyee)
#### Post date: [March 28, 2023, 2:33pm UTC](https://community.weweb.io/t/query-for-specific-index-item-in-a-collection/2126/2 "2023-03-28T14:33:14Z")

</div>

I’m new here too, and need to do that all the time 😉

I have only started looking, but I did notice this dropdown to switch from formula to Javascript:

![image](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/c/c5d208f976c759ea6d20eb8162819066fdea3c89.png)

This gives you editable js, possibly you could swap out the index number for a variable of some kind?

---

<div class="post-metadata">

### Author: ![pyee](https://avatars.discourse-cdn.com/v4/letter/p/848f3c/32.png) [@pyee](https://community.weweb.io/u/pyee)
#### Post date: [March 28, 2023, 2:33pm UTC](https://community.weweb.io/t/query-for-specific-index-item-in-a-collection/2126/3 "2023-03-28T14:33:49Z")

</div>

New users can only post one image at a time…

![image](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/e/e130ce0a88ad2133a14a4136d1d8e7b78ecbbc23.png)

---

<div class="post-metadata">

### Author: ![pyee](https://avatars.discourse-cdn.com/v4/letter/p/848f3c/32.png) [@pyee](https://community.weweb.io/u/pyee)
#### Post date: [March 28, 2023, 2:37pm UTC](https://community.weweb.io/t/query-for-specific-index-item-in-a-collection/2126/4 "2023-03-28T14:37:55Z")

</div>

This worked for me…

 ![image](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/c/c254551051d393b2a9c01a1e0dc2268899fd46c5.png)

Looks like you can chain some of this in for formula GUI as well, although I had to ‘hardcode’ the [‘name’] selector at the end.

---

<div class="post-metadata">

### Author: ![aurelie](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/aurelie/32/13249_2.png) [@aurelie](https://community.weweb.io/u/aurelie)
#### Post date: [March 28, 2023, 3:09pm UTC](https://community.weweb.io/t/query-for-specific-index-item-in-a-collection/2126/5 "2023-03-28T15:09:17Z")

</div>

Hey,  
best will be to use the formula `getByIndex`, first argument being your collection, second being your index.

But for your situation, I think that creating a page “Detail”, with dynamic url is the best. Provide the id of your prospect as parameter.  
Then on this page have collections with filtering using the url params (for example for gettings some of the prospect sub properties), or add an onPageLoad workflow to fetch your API endpoint with your id and store it inside a variable.

If you are coming from a code heavy background, you will normaly find yourself home in Weweb, as we try to follow as much as possible the “dev/code” way to do stuff, and try as much as possible to only provide a good ux interface on top of it for no code user.  
All our formula support javascript features, even if we encourage to use the nocode way (for better accessibility for other users), you can always fallback to the “code” way.

---

<div class="post-metadata">

### Author: ![aherbert](https://avatars.discourse-cdn.com/v4/letter/a/839c29/32.png) [@aherbert](https://community.weweb.io/u/aherbert)
#### Post date: [March 29, 2023, 8:28am UTC](https://community.weweb.io/t/query-for-specific-index-item-in-a-collection/2126/6 "2023-03-29T08:28:10Z")

</div>

I appreciate the swift and helpful replies! All methods shared work well. For our needs, the simple use of the manually written variable does the trick (though I swear we tried that already haha 🤷🏾)

---

<div class="post-metadata">

### Author: ![aurelie](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/aurelie/32/13249_2.png) [@aurelie](https://community.weweb.io/u/aurelie)
#### Post date: [March 29, 2023, 8:36am UTC](https://community.weweb.io/t/query-for-specific-index-item-in-a-collection/2126/7 "2023-03-29T08:36:02Z")

</div>

Maybe you forget the .data after the collection? Collection is an object containing metadata and the data itself. All our nocode formula understand that they need to access the data inside, but if you are going with the manuel selection that can be the problem 🙂
