'OR' condition in fetchXML - dynamics-crm-2015

I have to achieve 'OR' condition using fetchXML in CRM 2015 between two different entities. I need to make the condition contact.region = 'region1" or firm.region = "region1". I realize I have to use <link-entity> tag, but I am not sure how to implement 'OR' condition.

That's not possible. To get such kind of query you will have to make calls with such filters 2 times and then merge resultsets.

Related

Is there a way to query two indexes and join the result in Opensearch/ElasticSearch (Just like we do in RDBMS)

My requirement is
I have a deeply nested filter condition
Params from filter condition is located in two elastic search indexes
I need to pass the filter condition as query and get results which are joined by a field
The existing way is to use two indexes comma separated and searching but is supports only or - should condition. Reference : https://discuss.elastic.co/t/query-multiple-indexes-but-apply-queries-to-specific-index/127858
I need a way to support to and - must condition also.
Is there a possibility to do that? Thanks in Advance

Using aliased expression used in select clause into my order by clause for a criteria query

I have a requirement which is somewhat similar to this. My API supports a filter where there is more than 8 filter parameter. So, I want to create a query dynamically based on the filter parameter passed. I am using CriteriaBuilder to create a dynamic query.
Now, I am able to create dynamic queries successfully but the issue comes when the user wants to sort on an aggregate functions. In my query, I have 4 aggregate (count) function. So to support sorting on these columns, I just use the expression of this aggregate function but what I want is to use the alias of this expression
Repeating the expression in select and order by doesn't seem right to me. So, is there a solution/workaround to the problem. I want to declare the expression alias once and use it in both select and order by clause and if required in my group by clause in future
You probably need to build a custom projection class, you can find a decent and easy one, SQLProjectionWithAliasSupport in https://hibernate.atlassian.net/browse/HHH-2952 (from Sergey Pulyaev)
If then one wants to support also sub criteria, things get more complicate

Perform 'Is one of' filter using Dynamics365 Odata filter

When filtering in fields on D365, we have the filter option of 'is one of' which is more like SQL's where in clause. I'm trying to perform such filter operation using Odata but can't find the right way. Lambda has an any and all but don't know how to throw in a list to compare against.
Try using the In Function.
?$filter=Microsoft.Dynamics.CRM.In(PropertyName=#p1,PropertyValues=#p2)&#p1='name'&#p2=['value','value']
The full list of filter's.

How To Handle Pagination And Ordering In Cypher Query?

I am writing a cypher query in neo4j that merge few seperate queries with'UNION' operator. Now, the final result need to be sorted according to a specific column and I also need to be able to use 'LIMIT' to the final result so that I can fetch based on pagination request.
How to achieve that? adding 'ORDER BY' or 'LIMIT' at the end doesn't seems to work. Can't find a way to wrap the result as temporary set(as in sql queries) either. Any suggestions?
Currently it is not possible to add a ORDER BY or SKIP/LIMIT clause to the global set of UNION.
This is a pending feature request, see https://github.com/neo4j/neo4j/issues/2725
Maybe you can share your query and we can find a way to do it without UNION ?

Constructing dynamic linq queries based on user input

I am using dynamic linq on a project but don’t know how to run a particular query based on parameters. The example below shows the dynamic linq used to run 3 separate queries where a user has entered a filter expression or filer and sort expression etc. Without using if statements to check I (which seems incorrect and messy as I could end up with lots of if statements to cover the many different permutations ) I am unsure of how to generate the statements dynamically. Is this possible? I am running this query against Entity Framework.
context.Users.AsQueryable().Where(filterExpression)
context.Users.AsQueryable().Where(filterExpression).OrderBy(sortExpression)
context.Users.AsQueryable()Take(10).Where(filterExpression).OrderBy(sortExpression)
That should be achieved using expression tree only or may be using if..else clause
How to: Use Expression Trees to Build Dynamic Queries (C# and Visual Basic)

Resources