I’d like to show (in several text fields) data from the same database but with different conditions, like min, equeal.
See below
I’d like to show (in several text fields) data from the same database but with different conditions, like min, equeal.
See below
Ok. I got:
import wixData from ‘wix-data’;
wixData.aggregate(“dbase”)
.group(“category”)
.min(“price”)
.run()
.then( (results) => {
console.log(results.items);
$w(“#text1”).text = results.items[5].priceMin.toString();
$w(“#text2”).text = results.items[7].priceMin.toString();
$w(“#text3”).text = results.items[6].priceMin.toString();
} );
If this is proper, let it be a simple example.
Ok again… I see this is not a good example.
I found that sometimes wixData is getting variable values of indexes bolded below:
$w(" #text1 “).text = results.items[ 5 ].priceMin.toString();
$w(” #text2 “).text = results.items[ 7 ].priceMin.toString();
$w(” #text3 ").text = results.items[ 6 ].priceMin.toString();
console.log:
5: “{"_id":3,"priceMin":229}”
6: “{"_id":5,"priceMin":669}”
7: “{"_id":4,"priceMin":449}”
and couple of seconds later:
5: “{"_id":5,"priceMin":669}”
6: “{"_id":4,"priceMin":449}”
7: “{"_id":3,"priceMin":229}”
How to avoid this? HELP!
(I see that adding new dataset from wix menu and filter data is more simple than this…)