1

I have the first query:

  queryMuaj.Query = "<OrderBy>" +
                          "<FieldRef Name ='testb' Ascending = 'TRUE'/>" +
                    "</OrderBy>" +
                    "<Where>" +
                    "<And>" +
                          "<Geq>" +
                           "<FieldRef Name='testb' />" +
                              "<Value Type='DateTime' IncludeTimeValue='FALSE'>" + startDateFx + "</Value>" +
                          "</Geq>" +
                          "<Leq>" +
                              "<FieldRef Name='testb' />" +
                              "<Value Type='DateTime' IncludeTimeValue='FALSE'>" + endDatFx + "</Value>" +
                          "</Leq> " +
                    "</And>" +
                    "</Where>";

And I have the second qyery:

    query.Query = @"<Where><Eq>
                     <FieldRef Name='Team' />
                     <Value Type='Text'>" + selvalcomp+ @"</Value>
                  </Eq></Where>"

And I want to merge the 2 queries into a single query how can I do this? HELP ME PLEASE

Thanks.

2
queryMuaj.Query = "<OrderBy>" +
                          "<FieldRef Name ='testb' Ascending = 'TRUE'/>" +
                    "</OrderBy>" +
                    "<Where>" +
                    "<And>"+    
                       "<And>" +
                            "<Geq>" +
                            "<FieldRef Name='testb' />" +
                               "<Value Type='DateTime' IncludeTimeValue='FALSE'>" + startDateFx + "</Value>" +
                            "</Geq>" +
                            "<Leq>" +
                               "<FieldRef Name='testb' />" +
                                "<Value Type='DateTime' IncludeTimeValue='FALSE'>" + endDatFx + "</Value>" +
                            "</Leq> " +
                      "</And>" +
                      "<Eq>"+
                         "<FieldRef Name='Team' />"+
                         "<Value Type='Text'>" + selvalcomp+ "</Value>" +
                     "</Eq>"+
                   "</And>"+    
                   "</Where>";

Check my answer on how to write nested query

1

Try this query:

<OrderBy> <FieldRef Name ='testb' Ascending = 'TRUE'/> </OrderBy>
    <Where>
    <And>
    <Eq><FieldRef Name='Team' /><Value Type='Text'>" + selvalcomp+ "</Value></Eq>
    <And>
    <Geq><FieldRef Name='testb' /><Value Type='DateTime' IncludeTimeValue='FALSE'>" + startDateFx + "</Value></Geq>
    <Leq><FieldRef Name='testb' /><Value Type='DateTime' IncludeTimeValue='FALSE'>" + endDatFx + "</Value></Leq></And>
    </And>
    </Where>

Get some reference from this link about nest conditions in CAML query.

  • in my list for team I have a dropdown menu and it shows me nothing why? – Nderon Hyseni Jul 7 '16 at 8:50
  • Please ask a new question or describe your problem properly in question for better understand. – Dikesh Gandhi Jul 7 '16 at 8:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.