Hi,
I set one filter in my array with this code:
msg.payload = msg.payload.filter(e => e.title2.includes("P"))
and I see my list with all the item start with letter P.
Well, I'd like to see the item from the letter P (to follow this letter), not only with letter P ....., so, P,Q,R,S,T ...........
I don't understand. Can you give an example of what you mean.
Whatever you mean, can you not just add it to the function in the filter? Use the syntax with a separate filter function if the function gets complex as that makes it easier to follow.
Presumably you mean msg.payload.title contains that. So you have in message.payload.title ["A","B","C",....]
So you want to drop each element of the array until you get to the matching one, then include all the ones physically after that in the array up to the end of the array? Or do you mean you want to include all elements that are alphabetically after "D"? So if the array were ["E","A","D","C",....]
then you would drop the A and C but but keep the first one "E" and all elements alphabetically after "D" (and including "D"?
If I still haven't got it then show us real example of the incoming data and exactly what you want to get out.
@Colin
no, msg.payload is my array that contains more value like title, title2, isCheked, icon
and I try to filter by value "title2" to include all elements that are alphabetically after "D", (including "D"), so D, E, F, G .....
In this thread ..
there is one your post for the filter I use (modified for my values of course)
In the following image instead you can see my array with
the filter msg.payload = msg.payload.filter(e => e.title2.includes("C"))
and you can see all the values start with the letter C (only with letter "C"), while I'd like to see the values after "C" (including "C") (title2)
OMG,
it was enough modify the code from
msg.payload = msg.payload.filter(e => e.title2.includes("C"))
to
msg.payload = msg.payload.filter(e => e.title2 > "C")