Database Question - How to pull a certain "characteristic" of an item?

Hi all. I’m working on a project for my site that lets a user select their “Specialty of Medicine” and then display a “Low”, “Mid”, and “High” compensation number on a graph.

I’m a bit stuck on pulling specific information from the collection.

Here’s what I want to happen:

  1. User lands on page

  2. User selects his/her specialty from a dropdown menu

  3. The specialty information is pulled from the collection

  4. The information is displayed in a graph in an iframe

Below is the current code:


import wixData from ‘wix-data’;

var specialty = “Family Medicine”;
var compensation = null ;
var low = 0;
var average = 0;
var high = 0;

export function specialtySelection_change(event) {
specialty = $w(‘#specialtySelection’).value;
wixData.query(“#compData”).eq(“title”, specialty).find().then( (result) => {
compensation = result;
low = compensation[0].low;
average = compensation[0].average;
high = compensation[0].high;
$w(‘#html1’).postMessage(low); //this is an example of me sending the data to the iframe
});
}


If any of you know of specific resources that can help conceptually understand how to access particular “characteristics” of an “item” in a database, that would be appreciated. I’ve been learning javascript on the fly :blush:

You can play with the Content Examples found on the Examples Index page . These demonstrate how to perform queries on a collection, and how to filter the queries based on specific criteria. Play around, have fun, and then come back and visit the forum again.

Thanks for the direction, Yisrael!