简体   繁体   English

如何在“共享点列表”列中计算特定文本值

[英]How do I count a specfic text value in Sharepoint List column

Im currently trying to count the amount times a specific text string ( "1 JAN" & "2 FEB") occurs in SharPoint List column. 我目前正在尝试计算在SharPoint List列中出现特定文本字符串(“ 1 JAN”和“ 2 FEB”)的次数。 Below is my code it only returns the first text srting value it does not count 下面是我的代码,它仅返回不计算的第一个文本srting值 屏幕输出

function ResultsAT(xData, status) {
    var Month = []
    var dCounts = [i]
    var i = 0;
    var dNumber = 0;

    var TableRowScBrd = "<table>";
        TableRowScBrd += "<TR><TH style='text-align:            Left'>CLIENT</TH><TH>JAN</TH><TH>FEB</TH><TH>MAR</TH><TH>APR</TH><TH>MAY</TH><TH>JUN</TH><TH>JUL</TH><TH>AUG</TH><TH>SEP</TH><TH>OCT</TH><TH>NOV</TH><TH>DEC</TH><TH>Total</TH></TR>";


    $(xData.responseXML).find("z\\:row").each(function () {

        i = i + 1

        var sReportMonth = $(this).attr("ows_ReportMonth");
        var sServiceManager = $(this).attr("ows_ServiceManager");
        sServiceManager = sServiceManager.substr(sServiceManager.indexOf("#") + 1);
        var dCounts = $(this).attr("ows_ReportMonth");
        var Manager = sReportMonth + sServiceManager;
        var dReasons = $(this).attr("ows_ReportMonth");
        dReasons = dReasons.substr(dReasons.indexOf("#") + 1);


        if (Month[sServiceManager] == undefined) 
             {

            Month[sServiceManager] = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];

             }

           if (Month[sServiceManager] != undefined)
             {

              }

        if (dReasons == "1 JAN") { Month[sServiceManager][0] = dCounts; }
        if (dReasons == "2 FEB") { Month[sServiceManager][1] = dCounts; }
        if (dReasons == "3 MAR") { Month[sServiceManager][2] = dCounts; }


            dNumber = Month[sServiceManager][0] + Month[sServiceManager][1] + Month[sServiceManager][2]
        //                                                                                              TableRowScBrd += "<TR><td>" + sReportMonth  + "</td><td>" + sServiceManager + "</td><td>" + i + "</td><TR>";

    });


                   var key = "";
                  for (key in Month) {
                                                                                                               TableRowScBrd += "<TR><td style='text-align: Left'>" + key + "</td><td>" + Month[key][0] + "</td><td>" + Month[key][1] + "</td><td>" + Month[key][2] + "</td><TR>";
               }

           TableRowScBrd += "</Table>";
         $("#tasksAT").append(TableRowScBrd);



          }

Whilst I cant run your code now to verify, im pretty sure that it returns an xml structure of rows\\row. 虽然我现在无法运行您的代码进行验证,但我非常确定它返回的是行\\行的xml结构。 Therefore row would only find the first row. 因此,该行只能找到第一行。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何将下拉选择的值添加到共享点列表中的共享点查找列 - How to add dropdown selected value to sharepoint lookup column in sharepoint list 动态HTML电子表格Substring(),如何获取特定值? - Dynamic HTML Spread sheet, Substring(), how do I grab a specfic value? 单击以更新列表列时 SharePoint 传递文本框的值 - SharePoint passing value of text box on click to update list column 如何计算SharePoint库/列表中的新项目数? - How can I count the number of new items in SharePoint library/list? 如何在SharePoint 2013 JSOM中设置URL字段的值 - How do I set the value of a URL field in the SharePoint 2013 JSOM 如何将jquery onclick函数设置为仅针对特定的表列或可编辑表中的类? - How do I set jquery onclick function to target only specfic table columns or class in an editable table? 如何使用Javascript检查Sharepoint列表中列的值是空还是空? - How to use Javascript to check whether a value of a column in a Sharepoint list is either empty or null? 如何使用JavaScript的客户端对象模型在共享点列表中检索超链接数据类型列的值 - How to retrieve hyperlink data type column value in sharepoint list using client object model of javascript 截断 Sharepoint Online 列表中的“多行文本”列 - Truncate "Multiple lines of text" column in Sharepoint Online list 如何使用javascript从对象集中查找特定值计数 - How to find specfic values count from set of objects using javascript
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM