{"id":1002,"date":"2026-11-03T08:30:00","date_gmt":"2026-11-03T13:30:00","guid":{"rendered":"https:\/\/www.dataflowsoln.com\/blog\/?p=1002"},"modified":"2026-11-03T08:30:00","modified_gmt":"2026-11-03T13:30:00","slug":"why-your-bc-totals-and-reports-crawl","status":"publish","type":"post","link":"https:\/\/dataflowsoln.com\/blog\/why-your-bc-totals-and-reports-crawl\/","title":{"rendered":"BC Teardown #2: Why your BC totals and reports crawl"},"content":{"rendered":"\n<h2>The pain<\/h2>\n<p>A total that took a second when you went live now takes minutes. Users stare at a spinner and blame Business Central.<\/p>\n<h2>Why it happens<\/h2>\n<p>Custom code loops through every record and loads every field, just to add up one number. It gets slower with every order you post.<\/p>\n<h2>Before: Loop every row to add it up<\/h2>\n<pre style=\"background:#0c182c;color:#e6ecf5;padding:20px 24px;border-radius:10px;overflow-x:auto;font-size:15px;line-height:1.55;\"><code>SalesLine.SetRange(\"Document Type\",\n  SalesLine.\"Document Type\"::Order);\nif SalesLine.FindSet() then\n  repeat\n    Total += SalesLine.Amount;\n  until SalesLine.Next() = 0;\n\n\/\/ Reads every row and every column<\/code><\/pre>\n<h2>After: Let SQL do the math<\/h2>\n<pre style=\"background:#0c182c;color:#e6ecf5;padding:20px 24px;border-radius:10px;overflow-x:auto;font-size:15px;line-height:1.55;\"><code>SalesLine.SetRange(\"Document Type\",\n  SalesLine.\"Document Type\"::Order);\nSalesLine.CalcSums(Amount);\nTotal := SalesLine.Amount;\n\n\/\/ When you must loop, load only\n\/\/ the fields you actually use:\nItem.SetLoadFields(\"No.\", Description);<\/code><\/pre>\n<h2>The result<\/h2>\n<p>One query returns the total instead of thousands of row reads. Partial records keep loops lean.<\/p>\n<p><strong>Tip:<\/strong> Pair CalcSums with a key that has SumIndexFields for the biggest wins.<\/p>\n<p><a href=\"https:\/\/dataflowsoln.com\/blog\/wp-content\/uploads\/2026\/11\/BC-Teardown-2-carousel.pdf\" target=\"_blank\" rel=\"noopener\">Download this teardown as a PDF<\/a><\/p>\n<hr \/>\n<p><strong>Got a Business Central problem like this?<\/strong> Free 30 minute review of your setup. Senior Microsoft certified developers, and you talk to the person writing the code. <a href=\"https:\/\/www.dataflowsoln.com\/#contact\">Contact Dataflow Solutions<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>A total that took a second when you went live now takes minutes. Users stare at a spinner and blame Business Central.<\/p>\n","protected":false},"author":2,"featured_media":10,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[3,9,16],"class_list":["post-1002","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-bc-teardowns","tag-al","tag-business-central","tag-performance"],"_links":{"self":[{"href":"https:\/\/dataflowsoln.com\/blog\/wp-json\/wp\/v2\/posts\/1002","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dataflowsoln.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dataflowsoln.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dataflowsoln.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/dataflowsoln.com\/blog\/wp-json\/wp\/v2\/comments?post=1002"}],"version-history":[{"count":1,"href":"https:\/\/dataflowsoln.com\/blog\/wp-json\/wp\/v2\/posts\/1002\/revisions"}],"predecessor-version":[{"id":1024,"href":"https:\/\/dataflowsoln.com\/blog\/wp-json\/wp\/v2\/posts\/1002\/revisions\/1024"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/dataflowsoln.com\/blog\/wp-json\/wp\/v2\/media\/10"}],"wp:attachment":[{"href":"https:\/\/dataflowsoln.com\/blog\/wp-json\/wp\/v2\/media?parent=1002"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dataflowsoln.com\/blog\/wp-json\/wp\/v2\/categories?post=1002"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dataflowsoln.com\/blog\/wp-json\/wp\/v2\/tags?post=1002"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}