Query for Specific Index Item in A Collection

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

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

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

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

image

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

New users can only post one image at a time…

image

This worked for me…

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.

1 Like

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.

1 Like

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 :person_shrugging:t5:)

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 :slight_smile: