Get Text Field from dataset by another text field

Hello!
Before Asking Question I two days trying find answer - and cannot.

What help I request
I have database with three text fields
I have to find Value by another Value.

For example I have Text value from First columns
I need took Text value from a second and third from the same raw that in first i find

I need do this only by Code without any Visual elements

Let name
dataset3TextColumns

FirstTextCol (my input info somwhare in this columns)
SecondTectCol (My output which i need in the same raw here)
ThyrdTextCol

EnterString (for example I took it from dropdown_change(event) )
OutputString (for example I will use it in TEXT element)

If somebody help write code I will be very appreciate

Thank You in advance
sincerely
Mikhail

I’m not sure I got the question, but you should use data query.

  • you didn’t mention if you expect to get only one match or many matches for each query (I’ll assume you only want the first match)
    Maybe something like:
import wixData from 'wix-data';
let myTextQuery = "xxxxx";
wixData.query("My collection Name")
.eq("firstTextCol", myTextQuery) // the first element here is the field key, not the field name.
.find()
.then((results) => {
    if(results.items.length > 0) {
        let item = results.items[0];
        let secondText = item.secondTextCol; //the field key of the second column
        let thirdText = item.thirdTextCol; //the field key of the third column
    }else{
        //put here the code you want to execute in case of no match.
    }
})
1 Like

Dear J. D.
Thank You very much
It is exactly what I need and with your example I immediately write what I want.

It is already working.

Sincerely
Misha