Questions tagged [linq.js]

An implementation of List and Sequence operations for JavaScript, as inspired by .NET's Language INtegrated Query (LINQ).

LINQ.js

This project is an implementation of List and Sequence operations for JavaScript, as inspired by .NET's Language INtegrated Query (LINQ).

Features

  • All .NET 4.0 methods and many extras (with inspiration from Rx, Achiral, Haskell, Ruby, etc...)
  • Complete lazy evaluation
  • Full IntelliSense support for VisualStudio
  • Two versions - linq.js and jquery.linq.js (jQuery plugin)
  • Support Windows Script Host
  • Binding for Reactive Extensions for JavaScript(RxJS) and IntelliSense Generator -> see documentation
  • NuGet packages: linq.js, linq.js-jQuery, linq.js-Bindings

See or MSDN for more information regarding LINQ itself.

LINQ.js official website: http://linqjs.codeplex.com/

108 questions
5
votes
4 answers

linq.js to group by array of objects in javascript

I want to use linq.js to group the following data by date. data2 = [{ "date": 1399298400.0, "adId": 1057946139383, "impressions": 1000000 }, { "date": 1399298400.0, "adId": 3301784671323, "impressions": 535714 }......…
user40721
  • 327
  • 3
  • 5
  • 13
5
votes
1 answer

LINQ.JS, comparerSelector for Except

I'm trying to use LINQ.JS (not .Net LINQ!) and cannot get the comparerSelector concept. I have two arrays of objects, every object contains Id,Name,Date,Passport etc. I want to have a difference between them by the following 2 fields only: Id,Name.…
noober
  • 4,819
  • 12
  • 49
  • 85
5
votes
5 answers

linqjs group by with a sum

This might seems like an easy question but I'm struggling with the linqjs syntax. Given the following basic JSON: { "DateEvent": "2013-04-23 14:00:00Z", "DateRecord": "2013-04-23 14:00:00Z", "Amount": -9500, "Type": { …
paligap
  • 942
  • 1
  • 12
  • 28
4
votes
2 answers

linq.js return value of (default) FirstOrDefault

Trying to check on the result of linq.js FirstOrDefault(), but checking for null or undefined isn't working. Having some trouble debugging it, but I can see that it is returning some sort of object. There isn't any documentation for this method…
RJB
  • 2,063
  • 5
  • 29
  • 34
4
votes
2 answers

Efficient way to determine if there is more than one distinct item using linq.js

I'm looking for an efficient way using linq.js to determine if a collection has more than one distinct value. I assume that the following approach is inefficient because it has to consider the entire collection. if…
CalvinDale
  • 9,005
  • 5
  • 29
  • 38
3
votes
1 answer

Angular.js linq.js Where filter not working properly

I am using linq.js in AngularJs, I am using in many places and its working fine now I used in different place and it doesn't work for me. Not working means I am not achieving the desired result it always showing {}. please take a look below code if…
3
votes
1 answer

linq.js GroupBy on multiple columns with Sum

I am trying to group on 2 columns, and sum a third column, as shown here (paligap answer)- linqjs group by with a sum My code is - var linq = Enumerable.From(treedata); var result2 = linq .Where(x => x.GlPartnerLevel2 != null) …
Pundit
  • 33
  • 2
  • 5
3
votes
1 answer

linq.js Group By then Group By, How can it be achieved?

I want something that would result in this [{ firstName: "Sam", lastName: "Smith" }, { firstName: "Sam", lastName: "Doe" }, { firstName: "Sam", lastName: "Doe" }, { firstName: "Sam", lastName: "Joe" }] Being…
Ibrahim Ahmed
  • 2,295
  • 4
  • 21
  • 35
3
votes
1 answer

How do I chain "SelectMany" calls with linqjs (or flatten JSON)

Using linq.js how can I chain two SelectMany calls together. Given the following JSON structure: [ { "UpFrontCost": "29.95", "Currency": "USDAUD", "FittingDate": "2013-07-08 06:30:16Z", "Widgets": [ { …
paligap
  • 942
  • 1
  • 12
  • 28
2
votes
2 answers

LinqJs - Group by using distinct count

I am using LinqJs and trying to create a grouped set with a particular set of data. I have written the query in MS-SQL and would like some help to convert it into LinqJs. My main problem is trying to get the distinct count. This is my SQL query with…
2
votes
1 answer

Select distinct objects from nested arrays using linq.js

Let's say I have the following data, data: { variations: [{ steps: [ { Name: "Crawl", Status: "Complete" }, { Name: "Walk", Status: "InProgress" } ] },{ steps: [ { Name: "Crawl",…
Scott Lin
  • 1,532
  • 1
  • 18
  • 28
2
votes
2 answers

How to write Enumerable 'like' query using linq.js

I have JSON array like below. [ { "_Id": "0001", "_PatentId": "0000", "_Text": "Employee", "_Value": "employee", "_PermissionLevel": 55 }, { "_Id": "0002", "_PatentId": "0000", "_Text": "Employees", …
isanka thalagala
  • 456
  • 2
  • 10
  • 22
2
votes
1 answer

Need to iterate values in multi-dimensional array using LINQ JS

I have created array like below, arr =[ {uName:"2015", 1:100,2:10,3:0},{uName:"2011",1:10,2:2,3:19},{uName:"2015",1:10,2:0,3:20}], Here, I need to select arr[0][1] and arr[2][1] where uName is "2015". Linq query…
prabu_s
  • 137
  • 1
  • 6
2
votes
1 answer

Linq.js sub query

I am trying use Linq.js to get sub set of elements from JSON object in array. I have array of JSON object that one of them looks like this { "geometryType":2, "id":461219, "layer":"V_TRASA", "attributes": [ { …
Ivan Mjartan
  • 1,125
  • 1
  • 12
  • 23
2
votes
1 answer

In linq.js in need a query for list inside list

I am having a list like: var a=[ {col1:"a", list:[{subCol:"s1"},{subCol:"s2"}]}, {col1:"b", list:[{subCol:"s1"},{subCol:"s2"}]} ] Here am having list inside list. For this I want a query like enter code here linq(a).where("$.col1=='a' &&…
1
2 3 4 5 6 7 8