Wix Data connected to Dropdown Selected Value

I am trying to do something that I feel should be quite easy, but for some reason I cannot find how to do what I want on the forums.

In a nutshell, I want to be able to have a drop down input field connected to a data set (Currencies data set with the drop down showing currency code GBP, USD, EUR, etc.). I then want to be able to use the value selected in the drop down and go and fetch the conversion rate field from the collection for the selected record.

I have managed to capture the selected value into a variable with the following code inside the onChange event of the drop down:

let currencyCode = $w(“#currencydropdown”).value;

and I have also done something similar to get the Index of the selected record using:

let currencyIndex = $w(“#currencydropdown”).selectedIndex;

Any help greatly appreciated.

if you post the whole code with some screen shots of the elemts it may make it a bit clearer on what you are wanting to achieve to get help with.

Sure. This is my dropdown on the page:


And this is my code that is setup to track changes to that dropdown selection:

export function currencydropdown_change(event) {
let currencyCode = $w(“#currencydropdown”).value;

let currencyIndex = $w("#currencydropdown").selectedIndex;


This bit works fine, I can change the dropdown and select different currencies, and the relevant codes and indexes will appear in the console. What I need though is to fetch the associated rate for the selected currency.