Hi guys.
I have been working at this all day and still cannot get it to work.
I am querying a database that has item codes in it.
The user will enter an item code and the data query will return some product information on that item code.
I need a query to run again with all lower case characters if the initial query containing upper case characters return no values.
Can you help?
Below is what I have.
import wixData from "wix-data";
export function articleInput_input(event) {
wixData.query("DB1FKCompetitor")
.eq("articleCode", $w("#articleInput").value)
//used to filter the results by price
.find() // Run the query
.then(res => {
if(res.items.length > 0) {
let item = res.items[0];
$w("#table1").rows = res.items;
}
else {
//$w("#articleInput").value = $w("#articleInput").value.toLowerCase()
wixData.query("DB1FKCompetitor")
.eq("articleCode", $w("#articleInput").value.toLowerCase())
.find() // Run the query
.then(res2 => {
$w("#table1").rows = res2.items;
})
}
})}
$w.onReady(function () {
$w("#table1").columns = [{
"id": "1",
"dataPath": "fkMatch",
"label": "fkMatch",
"type": "string",
"width": 100,
}];
});