It doesn’t, but only because I simplified the example in my comment. I’m actually testing based on a column value, and I probably should have called my fake column “id” instead of “index”. In that case, a little testing in the listener gave me a workable pattern like the one you suggested. For example, testing if a row with id=5 exists looks like:
if 5 in grid.value.id
# ...
end
…which looks much better, but unfortunately, my actual grid is using a compound key. Consider:
t:insert page id text with 1 1 "frst" 1 2 "scnd" 2 1 "pg2" end
# +------+------+------+
# | page | id | text |
# +------+------+------+
# | 1 | 1 | frst |
# | 1 | 2 | scnd |
# | 2 | 1 | pg2 |
# +------+------+------+
And what I want to do is check to see if a given entry is the last entry for that page, which I’m doing by checking to see if the entry afterwards exists. So:
p:1
i:2
if extract where page=p where id=i+1 from t
0
else
# this executes, as page 1 id 3 is not in the table
end
i:1
if extract where page=p where id=i+1 from t
0
else
# this doesn't, as page 1 id 2 is in the table
end
Maybe there’s a cleaner way to do this, but if there is, I haven’t found it yet.