if query based on field value in database

Hi, quick question, how would you fetch a number from a field in the database and if the value of that field is higher than 20 then I want an action to happen say expand a column strip on that page.

Hey,
You can use the query function to fetch data from the DB collection and the expand after fetching the relevant data. If created a code snippet as an example:

import wixData from 'wix-data'; 

function filterDB(){
    wixData.query("myCollectionName")
        .find() 
        .then( (results) => { 
                //checking all the records of the collection
                results.forEach((result)=>{
                //if the field of the record is above 20, expand the strip
                if (result.fieldName > 20){
                    $w('#stripID').expand();
                }
            });             
         })
         .catch( (err) => { 
             let errorMsg = err;
         } );
}

I hope it’s clear.

Good luck,
Tal.