SharePoint caml query how to get if((condition && condition && (condition OR Condition)) items

I uses U2U canl builder to get queries,
How to write caml query for condition like,
(UserName==ABC && date1>=GivenDate1 && (date2<=givendate2 || date2 == null) )
one more
(UserName==ABC && date1>=givenDate1 && (date2<=givenDate2 || date3 <= givenDate2) )
SharePoint caml query if((condition && condition && (condition OR Condition))
Thanks

Hi,
According to your post, my understanding is that you wanted to Caml query with nested AND and OR for multiple fields.
The expression A AND B AND C looks like this:
<And>
A
<And>
B
C
</And>
</And>
Then the CAML query would look like as below.
<Where>
<And>
<And>
<Eq>
<FieldRef Name='AssignedTo'/>
<Value Type='User'>admin</Value>
</Eq>
<Geq>
<FieldRef Name='StartDate' />
<Value Type='DateTime'>2014-07-30T12:00:00Z</Value>
</Geq>
</And>
<Or>
<Leq>
<FieldRef Name='DueDate' />
<Value Type='DateTime'>2014-08-01T12:00:00Z</Value>
</Leq>
<IsNull>
<FieldRef Name='DueDate' />
</IsNull>
</Or>
</And>
</Where>
More reference:
http://msdn.microsoft.com/en-us/library/ms196939.aspx
http://sharepoint-experience.blogspot.com/2014/02/caml-query-with-nested-ands-and-ors-for.html
http://aasai-sharepoint.blogspot.com/2013/02/caml-query-with-multiple-conditions.html
Thanks & Regards,
Jason Guo
Jason Guo
TechNet Community Support

Similar Messages

  • Hierarchical query - How to get all parent records - Duplicate post

    Hi,
    In Oracle, START WITH, CONNECT BY commands will give all the direct and indirect child records. Other way round, is they are command which gives all the parent records till the root? Please let me know. I am working on Oracle 9i Release 2.
    Thanks a lot for your help.
    Edited by: skv on Nov 21, 2008 11:05 AM

    Duplicate post.
    Hierarchical query - How to get all parent records
    Please edit this post heading to duplicate post.
    Regards.
    Satyaki De.

  • SQL query - how to get parameters into a function within a SELECT statement

    Hi,
    I have SQL query roughly as follows
    SELECT A, B, C, MAX(CASE...) AS "D_NAME", FunctionX(B, C, "D_NAME")
    FROM...
    WHERE...
    How to get alias "D_NAME" as a valid parameter into FunctionX?

    Hi,
    user8819407 wrote:
    Hi,
    I have SQL query roughly as follows
    SELECT A, B, C, MAX(CASE...) AS "D_NAME", FunctionX(B, C, "D_NAME")
    FROM...
    WHERE...
    How to get alias "D_NAME" as a valid parameter into FunctionX?Either
    (1) repeat the calculation or
    (2) compute it in a sub-query
    Here's an example of (2)
    WITH  got_d_name  AS
        SELECT A, B, C, MAX(CASE...) AS "D_NAME"
        FROM...
        WHERE...
    SELECT  A, B, C, D_NAME, FunctionX (B, C, D_NAME)
    FROM    got_d_name
    ;A column alias (like d_name) can be referenced in the ORDER BY clause of the query where it was defined, but that's the only place in that query where it can be referenced.

  • ADF dynamic ViewObject based on query. how to get attributes?

    hi.
    i have an read-only view object based on query like this:
    SELECT :func(:paramm) as EMP_SAL from dual
    and set :func & :paramm parameter by vo.setNamedWhereClauseParam(..) function.
    but i couldn`t get EMP_SAL attribute after executeQuery command.
    in another case i would set new whole Query by vo.setQuery(..) but the problem exists.
    please help me. how to get attribute in such vo objects!
    thanks!
    Morena!

    thanks to Quick reply!
    i seek into code and found a uninitialized Parameter in view object. error has gone after correct the problem!
    and now could get the attribute value.
    thanks so much!
    /\/\ o r e n a!

  • Af:query : How to get sql

    Hi,
    How can i get SQL Query that is executing when I enter some criteria and click on Search button of query panel?
    I tried to override executeQuery() method of VOImpl and printed getQuery(). It is showing the query with bind variable in the query and vc_temp for the fields that are added in Advance mode.
    I want to get the actual query that is getting executed.
    Regards,
    Vino

    Can anyone help?

  • Af:query - How to get the result rowsets

    Hi,
    I have a requirement where i need to search the db rows on and append the results the adf rich table on each search.
    For this i am using af:query component. And trying to get the result rows for the named criteria.
    String mexpr = "#{bindings.DestinDescVOCriteriaQuery.processQuery}";
    processMethodExpression(mexpr, queryEvent, QueryEvent.class);
    ViewCriteriaManager vcm = getDestinDescViewObj().getViewCriteriaManager();
    ViewCriteria vc = vcm.getViewCriteria("DestinDescVOCriteria");
    getDestinDescViewObj().applyViewCriteria(vc);
    AdfFacesContext adfFacesContext = AdfFacesContext.getCurrentInstance();
    adfFacesContext.addPartialTarget(tblDestinDesc);
    However on each click of search the rows searched in the previous attempt are not retained.
    Can anyone let me know how to get the result from named criteria and append it the table?
    Thanks
    Ajay

    Can anyone help?

  • When we run query how it gets the characteristic values and attributes.

    Hi,
    When we load transaction data it chacks characteristic values then SIDs then DIM IDs then insert  DIM IDs into fact table but when we run the query how it checks and gets the characteristic values and attributes.
    Bye
    GK

    when we run the query how it checks and gets the characteristic values and attributes.
    Just the opposite way you have described. It gets from the corresponding masterdata tables, with the connected SID.

  • How to get the Shipping status of a Invoice items in SAP?

    Hi All,
    Is there any way to get the Shipping status of a Invoiced Item ?
    While i extracting Sales Invoice lines,i can get the shipping method and the shipping date,how can i confirm whether the item is shipped or not?.
    Is there any table which contains the shipping status or any column in Invoice lines(INV1) which contains the shipping status?
    Please help me to come out from that problem
    Thanks
    JanakiRaman

    Hello Gilbert,
    The column what you specified INV1.TRNSCODE is to know how the shipping was done. My question, Is there any field to specify the material was shipped or not?
    Thanks
    Janakiraman

  • How to get customer consignm orders (type of cat item KBN) updates LIS

    Good morning,
    we have an issue with this type of sales orders, we are trying to update an not standard info structure (created by us) but we have found that this type of category item is not relevant foe info structure updating (it has Statistics group for the item category
    equal blank).
    Does anybody know how to get that this type of item category is relevant foe that updating??
    thank you very much in advance,
    regards,
    Maria

    I believe you can use one of the customer exits in the FM which creates your IDOC to filter items.

  • Wiki Server: how to get rid of the "mail" nav menu item

    How do I get rid of the "mail" nav menu item at the top right of our Wiki? Our mail server isn't switched on so I wouldn't have expected it to show in the first place.

    I solved my issue, and it can probably help with yours too. Sounds like you'll have to enable web archives in order to disable them for individual groups.
    See my lonely thread at:
    http://discussions.apple.com/thread.jspa?messageID=7006339#7006339

  • How to get all recipients of a particular work item in workflow?

    Hi Abapers,
    I want to get all recipients of a particular work item in workflow?
    is any FM avilable for this purpose?
    Regards,
    Vinay.

    Hi,
    Please check FM     SAP_WAPI_WORKITEM_RECIPIENTS
    -Abhijit

  • How to get the checked attribute of a checkbox item from a PL/SQL process?

    Hello,
    I have a simple static form with one checkbox linked to a LOV containing one single value. I use this checkbox just to enable/disable other fields via Javascript. I am interested to fetch the "checked" attribute of this checkbox (and not the value of the checkbox) from an After Submit PL/Sql page process, so that I can process only the enabled fields.
    I can already imagine a workaround where we may store via Javascript the checked attribute of this checkbox in an hidden page item and then getting it from there, but I would really like to avoid it, as it would add unnecessary complexity and I would have to add more code to keep the hidden item always in synch with the checkbox status.
    Is there something like the V('page_item') PL/Sql function that can get a different attribute from a page item (like the checked one from a checkbox) and not only its value?
    I searched the forum for an answer to my question, but I couldn't find anything related.
    Thanks a lot,
    Paolo

    Paolo,
    HTML checkboxes are POSTed only if they are checked. So if your "checked" value is 'Y', for example, then your after-submit process can check if the item's value is 'Y' or not. Of course, you must be careful to set that item to null (or some non-checked value) in session state during page rendering so that previous values are not retained.
    Scott

  • SSRS report with cube – MDX query how to get an extra row with value '0'.

    Hello everyone,
    I'm unable to write the MDX query to get '0' value as first row in output. Following is my MDX query:
    WITH MEMBER [Measures].[Dummy] AS   '0'
    SELECT NON EMPTY Union( {[Measures].[Amount] },{[Measures].[Dummy]}) ON COLUMNS,
    NON EMPTY  { ([Customer].[Customer Nbr].[Customer Nbr].ALLMEMBERS * [Fiscal].[Year].[Year].ALLMEMBERS ) }
    having  [Measures].[Amount] > 5000
    ON ROWS FROM [cube]
    With above query, the output returns the value '0' as a separate column.
    I would like to get it in form of first row for [Measures].[Amount]. Like,
    Amount
    0
    500
    200
    100
    What needs to be changed to achieve the above result? I'm planning to use the above value in line chart to start the line from 0th value as described in following URL. (Note: The below URL is using SQL query and not MDX expressions.)
    http://spinerain.blogspot.in/2013/09/ssrs-line-chart-create-stacked-line-and.html
    Thanks, Ankit Shah
    Inkey Solutions, India.
    Microsoft Certified Business Management Solutions Professionals
    http://www.inkeysolutions.com/MicrosoftDynamicsCRM.html

    The round brackets in your expression are forcing an implicit crossjoin between the 3 lines. I would do the following which creates a set of the DummyYear plus the real year members and then crossjoin that with the customer set.
    WITH MEMBER [Fiscal].[Year].DummyYear AS   '0'
    SELECT NON EMPTY {[Measures].[Amount]} ON COLUMNS,
     NON EMPTY  {[Fiscal].[Year].DummyYear,
         [Fiscal].[Year].[Year].MEMBERS} *
                [Customer].[Customer Nbr].[Customer Nbr].MEMBERS
     having  [Measures].[Amount] > 5000
    ON ROWS FROM [cube]
    http://darren.gosbell.com - please mark correct answers

  • SSRS report with tabular model – MDX query how to get the sum and count of measure and dimension respectively.

    Hello everyone,
    I am using the following MDX query on one of my SSRS report.
    SELECT NON EMPTY { [Measures].[Days Outstanding], [Measures].[Amt] } ON COLUMNS,
    NON EMPTY { ([Customer].[Customer].[Customer Key].ALLMEMBERS) }
    HAVING [Measures].[ Days Outstanding] > 60
    DIMENSION PROPERTIES MEMBER_CAPTION, MEMBER_UNIQUE_NAME ON ROWS
    FROM ( SELECT ( STRTOSET(@Location, CONSTRAINED)) ON COLUMNS
    FROM ( SELECT ( {[Date].[Fiscal Period].&[2014-06]}) ON COLUMNS
    FROM [Model]))
    Over here, the data is being filtered always for current month and for a location that is being selected by user from a report selection parameter.
    I would like to get the count of total no. of customers and sum of the amount measure.
    When I am using them in calculated members it gives incorrect values. It considers all records (ignores the sub-select statements) instead of only the records of current month and selected location.
    I also tried with EXISTING keyword in calculated members but there is not difference in output. Finally, I manage the same at SSRS level.
    Can anybody please advise what are the ways to get the required sum of [Measures].[Amt] and count of [Customer].[Customer].[Customer Key].ALLMEMBERS dimension?
    Also, does it make any difference if I manage it as SSRS level and not at MDX query level?
    Any help would be much appreciated.
    Thanks, Ankit Shah
    Inkey Solutions, India.
    Microsoft Certified Business Management Solutions Professionals
    http://www.inkeysolutions.com/MicrosoftDynamicsCRM.html

    Can anybody please advise what are the ways to get the required sum of [Measures].[Amt] and count of [Customer].[Customer].[Customer Key].ALLMEMBERS dimension?
    Also, does it make any difference if I manage it as SSRS level and not at MDX query level?
    Hi Ankit,
    We can use SUM function and COUNT function to sum of [Measures].[Amt] and count of [Customer].[Customer].[Customer Key].ALLMEMBERS dimension. Here is a sample query for you reference.
    WITH MEMBER [measures].[SumValue] AS
    SUM([Customer].[Customer].ALLMEMBERS,[Measures].[Internet Sales Amount])
    MEMBER [measures].[CountValue] AS
    COUNT([Customer].[Customer].ALLMEMBERS)
    MEMBER [Measures].[DimensionName] AS [Customer].NAME
    SELECT {[Measures].[DimensionName],[measures].[SumValue],[measures].[CountValue]} ON 0
    FROM [Adventure Works]
    Besides, you ask that does it make any difference if I manage it as SSRS level and not at MDX query level. I don't thinks it will make much difference. The total time to generate a reporting server report (RDL) can be divided into 3 elements:Time to retrieve
    the data (TimeDataRetrieval);Time to process the report (TimeProcessing);Time to render the report (TimeRendering). If you manage it on MDX query level, then the TimeDataRetrieval might a little longer. If you manage it on report level, then the TimeProcessing
    or TimeRendering time might a little longer. You can test it on you report with following query: 
    SELECT Itempath, TimeStart,TimeDataRetrieval + TimeProcessing + TimeRendering as [total time],
    TimeDataRetrieval, TimeProcessing, TimeRendering, ByteCount, [RowCount],Source
    FROM ExecutionLog3
    WHERE itempath like '%reportname'
    Regards,
    Charlie Liao
    TechNet Community Support

  • How to get sum based on passed (where condition) value

    Hi all,
    I am having table with empno and jobtitlehours as fields. For each employee, 3 types of jobtitlehours are there. For example, for empno1, he has
    consultant(30 hours), programmer(27 hours), Projectleader(40 hours).
    I want to sum the the jobtitlehours. I am passing employee number as parameter to procedure, which will return the sum of jobtitlehours for that
    employee number.
    How to solve this. As for as i know, we cannot pass WHERE condition with GROUP BY clause.
    Thanks in advance,
    Pal

    It is always helpful to provide the following:
    1. Oracle version (SELECT * FROM V$VERSION)
    2. Sample data in the form of CREATE / INSERT statements.
    3. Expected output
    4. Explanation of expected output (A.K.A. "business logic")
    5. Use \ tags for #2 and #3. See FAQ (Link on top right side) for details.
    Are you looking for something like this?SELECT SUM(consultant + programmer + projectleader)
    FROM emp_x
    WHERE empno = :p_empno

Maybe you are looking for

  • N+1 and #of hosts per cluster

    Is thee a general rule on how many hosts shold be reserved for HA? Is N+1 the general rule based on how many nodes? when do I need +2 or 3? and should the +1,2,3 be in maintenance mode?

  • How do i rotate the pictures when i download them to my windows 7 computer

    I have downloaded my pictures from my Iphone 4s to my computer and all the pictures are sideways. How can I turn them up right? I have tried everything.

  • Payment due date was changed without notice

    I received a text message on 7/9/15 advising me my bill would be due on 7/23/15 rather than 8/1/15.  A text message is really not an appropriate form of notification first of all. If I'm 2 days late you charge me a late fee, yet my billing cycle can

  • Flash web gallery

    I wanted to make a web gallery using Bridge CS4. The preset was flash gallery. The problem is that all diagonal lines in the pictures end up terribly jagged! Lightroom btw. made a perfect flash gallery with the same pics.

  • Does anyone find the password reset frustrating?

    Does anyone find that the constant update to the security password is not only a hassle but also has a negative impact on its customers. Today I lost my phone, so I went to icloud on my computer, and it said I needed to reset my password. I couldn't