I'm developing a web application using SPservices for interaction with Sharepoint lists.
My question is on how to create a dynamic Caml Query using the And and Or conditions.
The condition below caters to me, works perfectly
var consultaInicio = "<Query><OrderBy><FieldRef Name='ID' Ascending='TRUE'/></OrderBy><Where>";
var consultaFim = "</Where></Query>";
var consultaFiltros = "";
var consultaAnd = "";
consultaFiltros += "<Geq><FieldRef Name='ID' /><Value Type='Number'>" + min_id + "</Value></Geq>";
consultaAnd += "<And>";
consultaFiltros += "<Leq><FieldRef Name='ID' /><Value Type='Number'>" + max_id + "</Value></Leq></And>";
consultaAnd += "<And>";
consultaFiltros += "<Eq><FieldRef Name='NIVEL_REAL' /><Value Type='Text'>5</Value></Eq></And>";
consultaAnd += "<And>";
consultaFiltros += "<Eq><FieldRef Name='PILAR' /><Value Type='Text'>" + pilar + "</Value></Eq></And>";
consultaAnd += "<And>";
consultaFiltros += "<Eq><FieldRef Name='COMPETENCIA_x003a_ID' /><Value Type='Text'>" + arr_competencia_temp[0] + "</Value></Eq>";
var public_consulta = consultaInicio + consultaAnd + consultaFiltros + consultaFim;
The problem is in adding to this Caml Query a condition of Or for the FieldRef "COMPETENCE_X003a_ID".
In the search form filter, the user can select more than one "COMPETITION".
can you help me?
Is there another way of doing the consultation?