0

hello everyone form this query to find column records until this moment works for me but when I want to add that look for other records of the column department gives error I would appreciate your help

Query Good

"<View><Query><Where><Or><Eq><FieldRef Name='Usuario'/><Value Type='Text'>" + Txt_Buscar.Text + "</Value></Eq>" + "<Eq><FieldRef Name='Puesto'/><Value Type='Text'>" + Txt_Buscar.Text + "</Value></Eq></Or></Where></Query></View>"

Query Bad

"< View >< Query ><Where><Or><Or><And><Eq><FieldRef Name = 'Usuario' />< Value Type = 'Text' >" +Txt_Buscar.Text +  "</ Value ></ Eq >" +  "< Eq >< FieldRef Name = 'Puesto' />< Value Type = 'Text' >" +Txt_Buscar.Text + "</ Value ></ Eq >" + "< Eq > < FieldRef Name = 'Departamento' /> < Value Type = 'Text' >" + Txt_Buscar.Text + "</ Value > </ Eq ></ Or ></ Or ></And></ Where ></Query></View>";
  • Entonces la referencia por este es 'Departamento', verdad? Pero es el tipo "text" tambien o un otra cosa? Si no es mismo... es posible este es la problema. – Chris Fells Sep 28 '18 at 0:06
0

As per your code the query is not well formated. The above query can be written as below

"< View >< Query ><Where><Or><And><Eq><FieldRef Name = 'Usuario' />< Value Type = 'Text' >" +Txt_Buscar.Text +  "</ Value ></ Eq >" +  "< Eq >< FieldRef Name = 'Puesto' />< Value Type = 'Text' >" +Txt_Buscar.Text + "</ Value ></ Eq ></And>" + "< Eq > < FieldRef Name = 'Departamento' /> < Value Type = 'Text' >" + Txt_Buscar.Text + "</ Value > </ Eq ></ Or></ Where ></Query></View>"

or if you want query to be as the above correct one with additional AND condition so refer below query

"< View >< Query ><Where><And><Or><Eq><FieldRef Name = 'Usuario' />< Value Type = 'Text' >" +Txt_Buscar.Text +  "</ Value ></ Eq >" +  "< Eq >< FieldRef Name = 'Puesto' />< Value Type = 'Text' >" +Txt_Buscar.Text + "</ Value ></ Eq ></ Or>" + "< Eq > < FieldRef Name = 'Departamento' /> < Value Type = 'Text' >" + Txt_Buscar.Text + "</ Value > </ Eq ></And></ Where ></Query></View>"
0

Usuario=Txt_Buscar.Text or Puesto=Txt_Buscar.Text or Departamento=Txt_Buscar.Text:

"<View><Query><Where>
<Or>
    <Or>
        <Eq><FieldRef Name = 'Usuario' /><Value Type = 'Text'>" +Txt_Buscar.Text +  "</Value></Eq>" +  
        "<Eq><FieldRef Name = 'Puesto' /><Value Type = 'Text'>" +Txt_Buscar.Text + "</Value></Eq>
    </Or>" + 
    "<Eq><FieldRef Name = 'Departamento' /><Value Type = 'Text'>" + Txt_Buscar.Text + "</Value></Eq>
</Or>
</Where></Query></View>"

Query schema in CAML

0

I tried the queries that you recommended me and gives this error

enter image description here

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.