This project has moved. For the latest updates, please go here.

When it is necessary to add .ToArray() at end of a query? also intermittently get problems with variables being "undefined"....

Feb 27, 2012 at 9:18 PM

Hi, and thanks for very much for creating JSLINQ, it is a great idea and from what I have seen so far appears to be very good.

However, and this may be due more to my lack of familiarty with javasript rather than JSLINQ per se but I would be grateful for any advice/comments on the following:


(1) It's not clear to me from the documentation when .ToArray() needs to be added to the end of a JSLINQ query, e.g.

  var arrayforselectedIndex = JSLINQ(viewModel.fullChartData())

                             .Where(function(item) { return item.Name == viewModel.selectedIndex(); })

                             .OrderBy(function(item) { return item.MonthEndDate; }).ToArray();

At first I omitted the .ToArray() at the end, but then I seemed to get intermittent (i.e. not always) errors when trying to access a property of one of the results of the query, e.g.

arrayforselectedIndex [0].MyProperty (where I know that all results from the query are members of the same class which has a MyProperty property.


(2) Similarly, I sometimes get "variable is undefined" errors  when trying to access the results of a JSLINQ query.  Any suggestions?

Thank you