Data row whose clauses

Quick question: is this a bug in AS Studio or am I getting the syntax wrong?

– theDataSource is a data source, with each row consisting of a data cell “tunetag” that holds a string.


get (id of (every data row of theDataSource) whose (contents of data cell "tunetag") is equal to "90s")

This returns {17}. The problem is that almost every string I search for returns {17}.
Yet, when I ask for :


get contents of data cell "tunetag" of data row id 20 of theDataSource

I get: “90s”, which is only in the data source ONCE. So, it appears that even though “90s” and almost all other cells are NOT data row id 17, that is what the ‘whose’ clause returns.

Oh, I also tried other variations, such as “content of data cell” (instead of “contents”), and I tried “is” instead of “is equal to.” All returned the same situation: whose thinks that every term is data row id 17.

The only search term that did NOT get data row id was the search term of the very last row (as sorted), which returned the correct value. By the way, data row id 17 is the id of the first row when viewed as sorted. I also tested turning off “sorted” for the data source and got the same results.

Any idea what is wrong?

I suspect this is a parentheses issue. You can also try adding “of it” which may help:

Jon


[This script was automatically tagged for color coded syntax by Convert Script to Markup Code]

1 Like

Strangely enough, the following works:


get id of (every data row of theDataSource) whose (contents of data cell 1) is equal to "90s"

Even though naming the data cell does NOT work. So, it seems that to use a whose clause with data rows, you cannot refer to the data cell by name. Anyone else notice this, or have further insight? This does not seem right. It’s very frustrating, and I wasted a lot of time figuring it out.

Jon,

It was not a parentheses issue, but the “of it” made a difference. I suppose I can see how that helps, but it doesn’t seem like it should be necessary, since I’m already referring to the data row.

Thanks. This helps a lot.