{"id":21325,"date":"2022-04-11T13:56:08","date_gmt":"2022-04-11T11:56:08","guid":{"rendered":"https:\/\/help.openbee.com\/open-bee-scan-capture\/knowledge-base\/how-to-guides\/scripts-in-capture\/case-studies\/index\/index-sum-of-item-lines\/"},"modified":"2026-05-13T09:36:49","modified_gmt":"2026-05-13T07:36:49","slug":"index-sum-of-item-lines","status":"publish","type":"page","link":"https:\/\/help.openbee.com\/en\/open-bee-scan-capture\/knowledge-base\/how-to-guides\/scripts-in-capture\/case-studies\/index\/index-sum-of-item-lines\/","title":{"rendered":"Index: Sum of Item Lines"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\" id=\"Index:Sommedeslignesarticles-Principe:\">Principle:<\/h2>\n\n<p>Calculate the sum of the amounts of an index present in the item lines (this index must not be scripted)<\/p>\n\n<h2 class=\"wp-block-heading\" id=\"Index:Sommedeslignesarticles-Script:\">Script:<\/h2>\n\n<pre class=\"wp-block-code\"><code>var sumOfAmount = function(pParameters){\n    var finalSum = 0.0;\n    var articles = getArticleLines(pParameters, \"ARTICLES_INDEX\");\n    if(articles == null)\n    \treturn finalSum;\n    for(var i=0;i&lt; articles.length; i++){\n    \tvar txtAmount = getTextFromIndexInfo(getIndexFromArticleLine(articles&#91;i], \"AMOUNT_ARTICLES_INDEX\"));\n    \tif(txtAmount != null){\n    \t\tvar amount = parseFloat(txtAmount.replace(',', '.'));\n    \t\tif(amount != null)\n    \t\t\tfinalSum += amount;\n    \t}\n    }\n    return finalSum;\n};<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Principle: Calculate the sum of the amounts of an index present in the item lines (this index must not be scripted) Script:<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":21276,"menu_order":6,"comment_status":"closed","ping_status":"closed","template":"templates\/ob-help-products.php","meta":{"footnotes":""},"class_list":["post-21325","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/help.openbee.com\/en\/wp-json\/wp\/v2\/pages\/21325","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/help.openbee.com\/en\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/help.openbee.com\/en\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/help.openbee.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/help.openbee.com\/en\/wp-json\/wp\/v2\/comments?post=21325"}],"version-history":[{"count":1,"href":"https:\/\/help.openbee.com\/en\/wp-json\/wp\/v2\/pages\/21325\/revisions"}],"predecessor-version":[{"id":21328,"href":"https:\/\/help.openbee.com\/en\/wp-json\/wp\/v2\/pages\/21325\/revisions\/21328"}],"up":[{"embeddable":true,"href":"https:\/\/help.openbee.com\/en\/wp-json\/wp\/v2\/pages\/21276"}],"wp:attachment":[{"href":"https:\/\/help.openbee.com\/en\/wp-json\/wp\/v2\/media?parent=21325"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}