Questions tagged [query-expressions]

Use for assistance when dealing with Microsoft Dynamics CRM QueryExpression objects and their use.

Query expressions are used in methods that retrieve more than one record, such as the IOrganizationService.RetrieveMultiple method, in messages that perform an operation on a result set specified by a query expression, such as BulkDeleteRequest and when the ID for a specific record is not known.

Useful Links:

  1. Build queries with QueryExpression
  2. Code sample
126 questions
24
votes
2 answers

Extended computation expressions without for..in..do

What I mean by extended computation expressions is computation expressions with custom keywords defined via CustomOperation attribute. When reading about extended computation expressions, I come across very cool IL DSL by @kvb: let il =…
pad
  • 41,040
  • 7
  • 92
  • 166
23
votes
2 answers

How do you compose query expressions in F#?

I've been looking at query expressions here http://msdn.microsoft.com/en-us/library/vstudio/hh225374.aspx And I've been wondering why the following is legitimate let testQuery = query { for number in netflix.Titles do where…
Brian Rosamilia
  • 1,448
  • 14
  • 24
18
votes
1 answer

Is there a LINQ syntax for the (T, int) overloads of Where and Select?

The query var q = from elem in collection where someCondition(elem) select elem; translates to var q = collection.Where(elem => someCondition(elem)); Is there a LINQ syntax that would translate to the following? var q =…
Timwi
  • 65,159
  • 33
  • 165
  • 230
17
votes
1 answer

OR condition in filter expression for dynamo db

I have a use case where I need to query dynamo db programatically using dynamo db query expression. e.x suppose there is two attributes for the A and B and I want a filter expression like (A='Test' OR A ='Test1') and B='test2'. I searched related…
14
votes
8 answers

What is the difference between LINQ query expressions and extension methods

Below are two queries that return the same data. Other then style I am not sure which is better. What factors influence these queries? What are the benefits of using one style over the other? Sample 1 var x = from s in db.Surveys join sq in…
TonyAbell
  • 1,310
  • 4
  • 19
  • 28
14
votes
2 answers

Implementing goMongoDB-like Query expression object evaluation

I've been looking for a MongoDb-like ( http://docs.mongodb.org/manual/applications/read/#find, docs.mongodb.org/manual/reference/operators/ ) query expression object evaluation function implementation or a class. It may cover not all the advanced…
14
votes
3 answers

Multiple conditions for a FilterExpression

I am using Condition expression but I'm unable to add more than one condition to a FilterExpression. Can any one help? I have posted my source code here. ConditionExpression with Filters: // Filter1 FilterExpression filter1 = new…
Kittu
  • 293
  • 1
  • 2
  • 9
7
votes
1 answer

How to Inner join with query expression crm

I'm trying to do a simple inner join with Query Expression. I'm trying to covert this query with QE but I got always the same error. I'm doing this QE: Entity Role = new Entity(); Role.LogicalName = "role"; Entity SystemUserRoles = new…
hello B
  • 891
  • 5
  • 18
  • 41
6
votes
4 answers

QueryExpression vs. FetchXml CRM2011

We found out that Linq for CRM 2011 is horribly broken - it seems to have gotten in without any QA performed on it. An indicator as how badly broken the provider is a query like .Where(x => x== "b") works but this .Where(x => "b" == x) might not…
Alwyn
  • 8,079
  • 12
  • 59
  • 107
6
votes
1 answer

How do I do a "contains" query with f# query expressions?

How do I do a query expression similar to a SQL IN-query? I'm trying to do something along these lines: let customerNumbers = set ["12345"; "23456"; "3456"] let customerQuery = query { for c in dataContext.Customers do …
NeoDarque
  • 3,222
  • 3
  • 19
  • 21
6
votes
1 answer

F# Query Expression "The field, constructor or member 'Contains' is not defined"

I'm trying to get this example from the Query Expressions page to work. I've got the database setup and I've made many small bits of code work. let idQuery = query { for id in [1; 2; 5; 10] do select id } query { …
Johnny Spittle
  • 297
  • 1
  • 9
5
votes
1 answer

With leftOuterJoin, .DefaultIfEmpty() is unnecessary

The documentation for leftOuterJoin Query Expressions on MSDN repeatedly implies through the samples that when using leftOuterJoin .. on .. into .. that you must still use .DefaultIfEmpty() to achieve the desired effect. I don't believe this is…
Jason Kleban
  • 20,024
  • 18
  • 75
  • 125
5
votes
1 answer

How to retrieve the SQL query string of an F# query expression via System.Data.SQLite?

I'm using the System.Data.SQLite and I'm trying to retrieve the SQL string that is generated by the query expression below. The query executes correctly, but the SQL string is SELECT NULL AS [EMPTY]. It seems that GetCommand().CommandText is not…
Armin
  • 1,052
  • 7
  • 18
5
votes
1 answer

Mobile Services query exception

When I use code with generic: var parenttable = MobileService.GetTable(); var testid = await parenttable.Where(prnt => prnt.Id == 20).ToListAsync(); where TParent: IEnity public interface IEnity { int Id { get; set; } } I…
R.Titov
  • 3,115
  • 31
  • 35
4
votes
1 answer

F# LINQ lastOrDefault unix Epoch

I am learning LINQ with F#. I want to know how to use lastOrDefault. If I have a SQL Server data table called Days, which store some date, I want to write a query to select the last date of the table, if there is no record, I want to return the…
John John
  • 377
  • 1
  • 11
1
2 3
8 9