I’m trying to retrieve just one of the threadMessage items in the nested array. This threadMessage could have multiple items in the array, but each item will have the same ThreadId.
Emails.data.threadMessages.where(‘threadMessage.ThreadId’,‘18d674721eab158d’,’==’)"
Keith you copied this value from the code editor or from inside the binding panel?
Because if I guess correct from the ending double quotes it must be straight from the editor…
I think that the property name should be enclosed in backquotes and not single quotes…
‘threadMessage.ThreadId’ this should be in the editor window: threadMessage.ThreadId
Can you check it please?
I’m writing in code view. Wappler’s binding panel can’t handle these expressions. It actually corrupts some of them if I open the in Data Bindings panel.
I’m getting closer. This returns the first threadMessage. I’ve done similar expressions before I just need to figure out why the .where isn’t working correctly. Emails.data.threadMessages[0].threadMessage
I thought I’ve done this before. But I could be wrong.
I am able to do fairly complex expressions like this. threadMessages.data.threadMessages.where('ThreadId', query.t, '==')[0].LabelIds.parseJSON().where('$value','STARRED','contains').values('$value')=='STARRED'"
I haven’t had any issues on any other expressions using single quotes. I did try your suggestion of switching it to back ticks, but it didn’t change anything.
I was hoping there was a way to dot walk into the nested array with a where like this, but maybe @franse is right that it’s not possible. I’m hoping I’m just not writing it properly.
Dot notation is not supported in Wappler, you need a custom formatter
There was a related discussion here:
But I see comments of yours in that topic saying nesting works for you? I don't know, maybe you dreamed or misinterpreted (probably you were referring to dot-notation for accessing variables, but not as an argument for the .where formatter)
The first .where() needed to target the first item in the threadMessages array to return the threadMessage array where it’s ThreadId equals the query.t value.