本文介绍了使用SPServices的CAML查询动态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好!
$


我正在使用SPservices开发一个Web应用程序,用于与Sharepoint列表进行交互。



我的问题是如何使用And和Or条件创建动态Caml查询。



以下条件迎合我,完美运作

 var consultaInicio ="< Query>< OrderBy>< FieldRef Name ='ID'Ascending ='TRUE'/> ;< /排序依据><其中GT&;英寸; 
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;




问题是在这个Caml查询中添加了一个条件Or为FieldRef"COMPETENCE_X003a_ID"。



在搜索表单过滤器中,用户可以选择更多比一个"COMPETITION"。



你可以帮助我吗?
b
b $ b b b还有另一种做法吗?咨询?

解决方案

Hello!

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?

解决方案


这篇关于使用SPServices的CAML查询动态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-22 04:47