Search database by two fields

Hi users.

I have a customer form in which I need two input boxes. Let’s call these “Article” and “Code”.

The customer will enter an article number, such as “Baxter1” as well as a customer code, such as “Code1”, and the results shown will be the description, colour, price and image.

I need the results to ONLY show the price that relates to both the Article number input and the Code input. If the code entered is not exactly correct, i.e. no partial matches, then no results will show even if the article number is correct.

I also need the results to not auto-populate when the user is typing. A submit button can be used.

Essentially, I am trying to create a members-only section of my site where procurement staff can log in, enter the article number of their current product and their custom pricing code, and see the best alternative product that my company can offer.

Can anyone assist with the coding of this?

That sounds more like a job assignment than a cry for help.

I need the results to ONLY show the…

I also need the results to …
and so on…

You don’t even have shown any code, what you already have done till yet.
Or what you have tried to achieve your aim.

This is not a wish-concert here.

I need also a FERRARI :grin:

If you have problems with coding, then you can also hire specialist for this job.

For example here…
https://www.wix.com/corvid/forum/community-discussion/need-a-little-help-with-your-site-hire-a-corvid-web-developer

If you want to do it on your own, and learn all that CODING-STUFF, then do it step by step.

So your aim is to filter a DATABASE by 2 factors —> “Article-Code” and “CODE”, RIGHT ??? Yes i think you want do that.

So let us look into the API-REFERENCE…
Boooom, just 20 sec. of searching…

https://www.wix.com/corvid/reference/wix-data.WixDataFilter.html

import wixData from 'wix-data';

 wixData.query("myCollection")
  .eq("first_name", "John")
  .eq("last_name", "Doe")
  .find()
    .then( (results) => {
      if(results.items.length > 0) {
        let item = results.items[0];
       
      } else {
        // handle case where no matching items found
      }
    } )
    .catch( (err) => {
      let errorMsg = err;
    } );

…and booooooom, an alternative way, how to use a filter…

import wixData from 'wix-data';

// ...

function filter(low, high) {
  let filter = wixData.filter();

  if(low) {
    filter = filter.ge("price", low);
  }

  if(high) {
    filter = filter.le("length", high);
  }

  $w("#myDataset").setFilter(filter);
}

…and BOOOOOOOM, a site with examples… for example this one…

https://russian-dima.wixsite.com/meinewebsite/blank-3

Just take alook, and try to understand.

This will be just your FIRST-STEP! :wink:

But i know you wanted much more. :grin:

And also use the SEARCHBAR! —> This is some kind of MAGIC.

Excellent. Thanks :grinning:

I know, that you already have got some help, i saw your DOUBLE-POST here!
Bad Guy! xD