骆驼查询-还是问题?帮助 [英] Caml Query - Or problem? help

查看:112
本文介绍了骆驼查询-还是问题?帮助的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对具有级别的表有以下查询,并且在每个级别内都有子级别-我想找到位于用户级别/子级别前面的所有记录.为此,我想查找以下所有记录:

Hi i have the following query on a table that has a level, and within each level has sub levels- I want to find any records that are infront of the users level/sublevel. To this i want to find all records that:

(Belong to the employee) AND (<has a="" greater="" level="">  OR <{has a level equal} AND has a greater sublevl}>)</has>



这是我当前的查询:但是,它返回的记录甚至不属于输入的用户(使用< or> ;?有问题)



This is my current query: however it returns records that dont even belong to the user entered(Problem with use of the <or>?)

<where>                                             
   <and>
      <eq>
        <fieldref name="AssignedTo" />
        <value type="User">
        <userid />
        </value>
      </eq>   
      <or>
         <gt>
         <fieldref name="Skill_x002d_Set_x0020_Level" />
         <value type="Lookup">"+strEmpsSkillLvl+@"</value>
         </gt>
         <and>
                                                            
           <eq>
           <fieldref name="Skill_x002d_Set_x0020_Level" />
          <value type="Lookup">"+strEmpsSkillLvl+@"</value>
           </eq>
                                              
          <geq>
           <fieldref name="Station_x0020_Number" />
           <value type="Number">"+strEmpsStationNumber+@"</value>
          </geq>
          </and>
       </or>
     </and>
   </where>





*编辑





*EDIT

Yes list*

also by levels i'm refering to the data
I have a set of record of skills

with levels and parts ie:
    -Level1
     -part1
     -part2
     -part3
    -Level1
     -part1
     -part2
     -part3.

Also I have used CAML builder - however I seemed to have some issues getting the or encompassing the correct elements from what I have seen

Builder gives me the following which returns the wrong information still:
<pre><query>
                                            <where>
                                             <and>
                                              <eq>
                                                 <fieldref name="AssignedTo" />
                                                  <value type="User"><userid /></value>
                                              </eq>
                                              <or>
                                                <and>
                                                    <eq>
                                                        <fieldref name="Skill_x002d_Set_x0020_Level" />
                                                         <value type="Lookup">"+strEmpsSkillLvl+@"</value>
                                                    </eq>
                                                     <gt>
                                                        <fieldref name="Station_x0020_Number" />
                                                        <value type="Number">"+strEmpsStationNumber+@"</value>
                                                     </gt>
                                                </and>
                                                <gt>
                                                    <fieldref name="Skill_x002d_Set_x0020_Level" />
                                                    <value type="Lookup">" + strEmpsSkillLvl + @"</value>
                                                </gt>
                                              </or>
                                            </and>
                                            </where>
                                            <orderby>
                                            <fieldref name="Skill_x002d_Set_x0020_Level" ascending="True" />
                                            <fieldref name="Station_x0020_Number" ascending="True" />
                                            <fieldref name="Status" ascending="True" />
                                            </orderby></query>



(还会调试显示字符串确实包含正确的值.



(also debugging shows the strings do contain the right values.

推荐答案

尝试使用诸如 ^ ]来帮助您构建CAML.这将向您显示此查询有什么问题(很多事情)
Try using a tool such as CAML Builder[^] to assist you in building the CAML. This will show you what is wrong (many things) with this query


部分我的查询我认为-有点愚蠢现在(在我的代码中保留了< query>标记)

谢谢您通过标记获得的链接!
Partly my query i think- feel a bit stupid now(left the <query> tags in my code)

Thanks for that link though mark!


这篇关于骆驼查询-还是问题?帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆