2011-09-01 63 views
0
在SharePoint列表中的第一行

我試着用戶從我的下拉菜單中選擇第一個選項之後調用從SP名單的第一行(第二個選項調用第二行等)調用使用CAML

然而它調用的最後一排,當我選擇第一個選項(第二個選項調用第二最後一排等)

spList

所以選擇選項1月時,2010年我希望它顯示的第一行「總數[0]「,但它返回最後一行總數[4]。

進出口新的CAML所以任何幫助將是巨大的......

CAML代碼:

   var soapEnv = 
     "<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'> \ 
     <soapenv:Body> \ 
       <GetListItems xmlns='http://schemas.microsoft.com/sharepoint/soap/'> \ 
       <listName>db_Eff_book</listName> \ 
       <query> \ 
         <Query> \ 
          <Where> \ 
          <Geq> \ 
           <FieldRef Name='Date' IncludeTimeValue='FALSE' /> \ 
          <Value Type='DateTime'><Today OffsetDays='-1000' /></Value> \ 
          </Geq> \ 
          </Where> \ 
         <OrderBy><FieldRef Name='Date' Ascending ='False' /> \ 
         </OrderBy> \ 
          </Query> \ 
         </query> \ 
       <viewFields> \ 
       <ViewFields> \ 

if語句(要顯示錶時選擇選項):

     if (strDate == "Jan-2010") 


        { 
     var TableRowHtml = "<table id='box-table-a'>"; 
     TableRowHtml +="<TR><TH 'style='width: 50px'>OPERATIONS</TH></TR>"; 
      TableRowHtml +="<TR><TH 'style='width: 50px'>Unit Costs</TH></TR>"; 
    TableRowHtml +="<TR><TD>" + Total[0] + "</TD></TR>"; 

         } 
        else if (strDate == "Feb-2010") 


      { 
var TableRowHtml = "<table id='box-table-a'>"; 
    TableRowHtml +="<TR><TH 'style='width: 50px'>OPERATIONS</TH></TR>"; 
    TableRowHtml +="<TR><TH 'style='width: 50px'>Unit Costs</TH></TR>"; 
    TableRowHtml +="<TR><TD>" + Total[1] + "</TD></TR>"; 

        } 

        else if (strDate == "Mar-2010") 


      { 
    var TableRowHtml = "<table id='box-table-a'>"; 
    TableRowHtml +="<TR><TH 'style='width: 50px'>OPERATIONS</TH></TR>"; 
    TableRowHtml +="<TR><TH 'style='width: 50px'>Unit Costs</TH></TR>"; 
    TableRowHtml +="<TR><TD>" + Total[2] + "</TD></TR>"; 

        } 

        else if (strDate == "Apr-2010") 


      { 
    var TableRowHtml = "<table id='box-table-a'>"; 
    TableRowHtml +="<TR><TH 'style='width: 50px'>OPERATIONS</TH></TR>"; 
    TableRowHtml +="<TR><TH 'style='width: 50px'>Unit Costs</TH></TR>"; 
    TableRowHtml +="<TR><TD>" + Total[3] + "</TD></TR>"; 

       } 

DROPDOWN CODE:

  <tr><td><select id="combobox"> 
      <option value="Jan-2010">Jan/2010</option> 
      <option value="Feb-2010">Feb/2010</option> 
      <option value="Mar-2010">Mar/2010</option> 
        <option value="Apr-2010">Apr/2010</option> 
       <option value="May-2010">May/2010</option> 
       <option value="Jun-2010">Jun/2010</option> 

         </select></td> 
        <td><input type="button" id="RefreshMetrics" value="Refresh"></td> 
         </tr> 

回答

1
<OrderBy><FieldRef Name='Date' Ascending ='False' /> \ 
</OrderBy> 

應該是:

<OrderBy><FieldRef Name='Date' /> \ 
</OrderBy> 

要排序的值是按降序排列,所以四月將是第一和一月將是最後一次。

+0

感謝Rich ...... :) – MarkSull