Refer to the special i variable

I am trying to work out which entries in a query have the same date as a row in a listView where the query is called from.

This is usually done using the special [i] variable. In my app I have the query GetObjectsOnAccount which supplies the data to the listView and so I use GetObjectsOnAccount.data.EventDate[i] to get the current EventDate of the current row in the listView. If I hover over {{GetObjectsOnAccount.data.EventDate}} I get an array of dates and if I hover over {{GetObjectsOnAccount.data.EventDate[i]}} I get undefined - I guess because [i] is only available at the run time?

However, even when I run the query there is no value associated with {{GetObjectsOnAccount.data.EventDate[i]}} So when I try to find the difference between it and the data I get "NaN".

E.g. if I add a key 'EventDate2':data[j].EventDate2 = {{GetObjectsOnAccount.data.EventDate[i]}}; I get an empty "column"!

I am wondering if [i] isn't in the scope of this query? The query is called from a dropdown select component on the listView which calls one query which refers to two other queries (one of these queries is the one that refers to [i]?

Any body have clues? Thanks

Hey @jclutterbuck, You're right that the i variable isn't in scope in your GetResourceNotAvailable query. The good news is that assuming you're triggering this query with an event handler set on a component in your Listview, you can pass the i variable (or GetObjectsOnAccount.data.eventDate[i] itself) to this GetResourceNotAvailable with GetResourceNotAvailable.trigger({

additionalScope: {i}}) or GetResourceNotAvailable.trigger({additionalScope: {data: GetObjectsOnAccount.data.eventDate[i]}}) in a Run Script event handler. Here's a simple example:

I hope that works for your use case!