What is The Best Way To Extract A Single Value From an Array?

I have a data store (so basically an array) defined like this:

currencies
  id
  symbol
  currency_code

So in Wappler, currencies.data refers to the whole array.

I want to assign a single value from that array to something, so basically to say:

value = the symbol field from currencies where id==i_event_currency.value

So like a mysql select statement.

I know that this works:

currencies.data.values(`symbol`).where(`id`, i_event_currency.value, "==")[0]

Is this the best way to do this kind of simple lookup?

Or is there a method using the key/value operation that I am not understanding which makes more logical sense?

I would love to easily create this kind of lookup from the Wappler menu system but I’ve not found an easy way to do that yet, so any guidance on that would be great too.

Many thanks!

Antony.

Community Page
Last updated: