gunnery
November 19, 2022, 10:44pm
1
Wappler. Version 5.2.3
OS: Mac
Project: NodeJS
Issue: when adding a .where on a repeat it is not showing any of the data.
Code for repeat:
dmx-bind:repeat="members.data.query.where(`member_surname`, member_surname, 'fuzzySearch')
When a condition of where is added to a masonry repeat it throws the following error
TypeError: can't access property "length", t is undefined
where http://localhost:3000/dmxAppConnect/dmxFormatter/dmxFormatter.js:7
where http://localhost:3000/dmxAppConnect/dmxFormatter/dmxFormatter.js:7
where http://localhost:3000/dmxAppConnect/dmxFormatter/dmxFormatter.js:7
dmx.parse/$/< http://localhost:3000/dmxAppConnect/dmxAppConnect.js:7
n http://localhost:3000/dmxAppConnect/dmxAppConnect.js:7
parse http://localhost:3000/dmxAppConnect/dmxAppConnect.js:7
$updatePropBindings http://localhost:3000/dmxAppConnect/dmxAppConnect.js:7
$update http://localhost:3000/dmxAppConnect/dmxAppConnect.js:7
update http://localhost:3000/dmxAppConnect/dmxAppConnect.js:7
$update http://localhost:3000/dmxAppConnect/dmxAppConnect.js:7
update http://localhost:3000/dmxAppConnect/dmxAppConnect.js:7
$update http://localhost:3000/dmxAppConnect/dmxAppConnect.js:7
requestUpdate http://localhost:3000/dmxAppConnect/dmxAppConnect.js:7
<anonymous> http://localhost:3000/dmxAppConnect/dmxAppConnect.js:7
EventListener.handleEvent* http://localhost:3000/dmxAppConnect/dmxAppConnect.js:7
<anonymous> http://localhost:3000/dmxAppConnect/dmxAppConnect.js:7
dmxAppConnect.js:7:25533
bpj
November 19, 2022, 11:34pm
2
You just need '
around the first parameter of the where - it will evaluate it as a dmx expression
Apple
November 20, 2022, 3:46am
3
Wappler uses ` in the 1st paramteter of the where, the forum messed up a bit but he has them
bpj
November 20, 2022, 8:04am
4
If that is the case, where is the member_surname for the first parameter coming from? Is this masonry in a parent repeat or data detail ? Or should it be pointing to a sc/input value e.g.
.where('sc_memberdetails.data.member_surname',member_surname,'fuzzySearch')
If it’s looking for results from a search input it would probably be something like this
.where('inp_searchfield.value.lowercase()',member_surname.lowercase(),'fuzzySearch')
Apple
November 20, 2022, 8:24am
5
The 1st parameter is the property name from members.data.query so it should not have any sc stuff
The 2nd parameter is the variable to check, it can have sc stuff in it
I’d suggest testing the expression containing .where in dmx.parse() in the browser console, to see if it returns an array with items inside
bpj
November 20, 2022, 8:39am
6
Sorry. I’m on my phone and messed up the expression 1st/2nd parameter switched. It should be something like:
.where('member_surname',sc_memberdetails.data.member_surname,'fuzzySearch')
Or
.where('member_surname.lowercase()', inp_searchfield.value.lowercase(),'fuzzySearch')
The second parameter is the value being compared against and usually comes from another SC, an input or a variable.