开发者

Calling the first row in sharepoint list using Caml

Im trying to call the first row from a SP list after a user selects the first option from my dropdown menu ( second option calls second row etc... )

However its calling the last row when i select the first option ( second option calls second last row etc... )

Calling the first row in sharepoint list using Caml

So when Option 1 is selected Jan-2010 i want it to display the first row "Total[0]" but its returning the last row Total[4].

Im new to Caml so any help would be great...

CAML CODE:

             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 STATEMENT(TO DISPLAY TABLE WHEN OPTION SELECTED):

                     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>


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

should be:

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

You are sorting the values is descending order, so April is going to be first and January is going to be last.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜