# Lookup database field from random number

**URL:** <https://forum.adalo.com/t/lookup-database-field-from-random-number/30554>\
**Category:** Database\
**Created:** [August 8, 2022, 4:20pm UTC](https://forum.adalo.com/t/lookup-database-field-from-random-number/30554 "2022-08-08T16:20:41Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![SPower](https://avatars.discourse-cdn.com/v4/letter/s/77aa72/32.png) [@SPower](https://forum.adalo.com/u/SPower)\
**Post date:** [August 8, 2022, 4:20pm UTC](https://forum.adalo.com/t/lookup-database-field-from-random-number/30554/1 "2022-08-08T16:20:41Z")

</div>

Hi,

I need to view a record in a database based on a random number. I can create the random number using the RAND feature but cannot see how to create a view of the corresponding record in the database.

The structure of the database is Number, Card, Grade, Gender. The Number field is the RAND number and I need to display just the associated Card record. Is this possible?

TIA

---

<div class="post-metadata">

**Author:** ![Flawless](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.adalo.com/flawless/32/20131_2.png) [@Flawless](https://forum.adalo.com/u/Flawless)\
**Post date:** [August 8, 2022, 8:40pm UTC](https://forum.adalo.com/t/lookup-database-field-from-random-number/30554/2 "2022-08-08T20:40:50Z")

</div>

Welcome to the community @SPower 🕶

Is this an internal database collection or an external database that you’re querying?

If you’re using the internal Adalo database, you can add an on-screen action to update the logged-in user with a random number using the RAND function.

 ![Screen Shot 2022-08-08 at 2.44.01 PM](https://us1.discourse-cdn.com/flex020/uploads/adalo/original/3X/0/3/03ff53b8e07aa53edee58b765a32bdde47136bc5.png)

Then add a list of the database collection you want to display and add a custom filter to display that record:

 ![Screen Shot 2022-08-08 at 2.44.13 PM](https://us1.discourse-cdn.com/flex020/uploads/adalo/original/3X/2/a/2aa0a045ab6e68d46b149bd38e677557dc902b48.png)

If it’s an external database collection, it may be possible to add a query parameter to filter the random number using a custom formula:

 ![Screen Shot 2022-08-08 at 2.45.35 PM](https://us1.discourse-cdn.com/flex020/uploads/adalo/original/3X/0/4/04768bcc4b1e91bc76921c6b62248ffc347ea0b5.png)  
This would depend on the API that you’re using for the external collection.
