let ordernumber = order.number; ---->(type number)
wixData.query(‘Stores/Orders’)
.eq(“number”, ordernumber) ====> the number ID is of type number
.find()
.then( (results) => {));
The above code do not work as I used ordernumber in eq().
But if I replace “ordernumber” with number then query works fine
I need the value from ordernumber variable to equal to “number”
How to solve this?
Pretty simple, just look at the eq info from the API reference in your previous post that I replied to.
https://www.wix.com/corvid/reference/wix-data.WixDataQuery.html#eq
propertyName - string
The property whose value will be compared with value.
So, as shown in your images, that would be the Number field in your dataset with the field key of number.
value *
The value to match against.
The value must be number, it can’t be ordernumber as that is not a value that Wix uses.
It only matches values of the same type. For example, a number value stored as a String type does not match the same number stored as a Number type.
Matching strings with eq() is case sensitive, so “text” is not equal to “Text”.
You are searching for a text instead of a number. So convert your info to number …
Something like this …
let ordernumber = Number(order.number);