Searching Spry Data Sets

Need to quickly search through a Spry data set? Sam Mitchell shared this little gem with me: findRowsWithColumnValues. It allows you to search a dataset for a matching set of column, or columns. So for example, to return all boys from a set that has a gender column:

var boyRows = dsKids.findRowsWithColumnValues({"gender":"male"});

You can even tell the function to return immediately when it finds a match. This is useful for when you are searching by a primary key. Here is an example:

var theRow = dsKids.findRowsWithColumnValues({"id":"1"}, true);

Lastly, you can search by any number of columns:

var leftyBoyRows = dsKids.findRowsWithColumnValues({"gender":"male", "handiness":"left"});

A full example may be found here.

Like This?

If you like this article, please consider visiting my Amazon Wishlist or donating via PayPal to show your support. You can also subscribe to the email feed to get notified of new posts.