<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>article How to Create Previous Page Totals with PixelPerfect C# Scripts in Member Articles</title>
    <link>https://community.qlik.com/t5/Member-Articles/How-to-Create-Previous-Page-Totals-with-PixelPerfect-C-Scripts/ta-p/1483526</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;H1 class="article-title" style="margin: 0 0 0.5em; font-weight: normal; font-size: 2.5em; font-family: 'Times New Roman'; color: #222222;"&gt;&lt;/H1&gt;&lt;P style="margin: 0 0 1.5em; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;STRONG&gt;Description&lt;/STRONG&gt;: This tutorial illustrates how create a PixelPerfect Report with C# &lt;STRONG&gt;Scripts&lt;/STRONG&gt;. This Report calculates previous page totals using macros. You can use C#, Visual Basic or JavaScript to develop PixelPerfect Scripts. For a Visual Basic version of this tutorial refer to "&lt;SPAN style="color: #000099; font-style: inherit; font-family: inherit; text-decoration: underline; font-weight: inherit;"&gt;&lt;A _jive_internal="true" href="https://community.qlik.com/docs/DOC-14038"&gt;How to Create Previous Page Totals with PixelPerfect Visual Basic Scripts&lt;/A&gt;&lt;/SPAN&gt;".&lt;/P&gt;&lt;P style="font-size: 14px; font-family: 'Times New Roman'; color: #333333;"&gt;&lt;/P&gt;&lt;DIV class="step-container" style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;H2 class="step-title" style="margin: 0 0 0.75em; border-bottom-style: solid; border-bottom-color: #cccccc; font-weight: normal; font-style: inherit; font-size: 1.5em; font-family: inherit; color: #222222;"&gt;Create a New PixelPerfect Report&lt;/H2&gt;&lt;DIV class="step-image-container" style="margin: 0 0 1em; padding: 5px; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Create-a-New-PixelPerfect-Report.png" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/107225_Create-a-New-PixelPerfect-Report.png" style="height: auto;" /&gt;&lt;/P&gt;&lt;OL style="margin: 0 1.5em 1.5em; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;LI&gt;Select &lt;STRONG&gt;Reports&lt;/STRONG&gt; in the lower left-hand panel&lt;/LI&gt;&lt;LI&gt;Select the &lt;STRONG&gt;PixelPerfect report&lt;/STRONG&gt; type in the panel just above&lt;/LI&gt;&lt;LI&gt;Select &lt;STRONG&gt;PixelPerfect&lt;/STRONG&gt;&lt;STRONG&gt;Report&lt;/STRONG&gt; in the &lt;STRONG&gt;New&lt;/STRONG&gt; group of the tool bar.&lt;/LI&gt;&lt;/OL&gt;&lt;/DIV&gt;&lt;H2 class="step-title" style="margin: 0 0 0.75em; border-bottom-style: solid; border-bottom-color: #cccccc; font-weight: normal; font-style: inherit; font-size: 1.5em; font-family: inherit; color: #222222;"&gt;Name the Report&lt;/H2&gt;&lt;P&gt;&lt;IMG alt="Name-the-Report.png" class="jive-image image-2" src="https://community.qlik.com/legacyfs/online/107226_Name-the-Report.png" style="height: auto;" /&gt;&lt;/P&gt;&lt;OL style="margin: 0 1.5em 1.5em; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;LI&gt;Enter "&lt;STRONG&gt;PixelPerfect Previous Page Total with C# Script" &lt;/STRONG&gt;as name for your report&lt;/LI&gt;&lt;LI&gt;Select &lt;STRONG&gt;New&lt;/STRONG&gt; in the &lt;STRONG&gt;Template&lt;/STRONG&gt; group of the tool bar.&lt;/LI&gt;&lt;/OL&gt;&lt;H2 class="step-title" style="margin: 0 0 0.75em; border-bottom-style: solid; border-bottom-color: #cccccc; font-weight: normal; font-style: inherit; font-size: 1.5em; font-family: inherit; color: #222222;"&gt;Create a Table&lt;/H2&gt;&lt;P&gt;&lt;IMG alt="Create-a-Table.png" class="jive-image image-3" src="https://community.qlik.com/legacyfs/online/107227_Create-a-Table.png" style="height: auto;" /&gt;&lt;/P&gt;&lt;OL style="margin: 0 1.5em 1.5em; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;LI&gt;Add &lt;STRONG&gt;CH294&lt;/STRONG&gt; as a Level. For more explanation on the Level creation please refer to "&lt;A _jive_internal="true" href="https://community.qlik.com/docs/DOC-8405"&gt;How to Create a Simple PixelPerfect Report&lt;/A&gt;"&lt;/LI&gt;&lt;LI&gt;Create the table into the report. Don't insert any column totals.&lt;/LI&gt;&lt;/OL&gt;&lt;H2 class="step-title" style="margin: 0 0 0.75em; border-bottom-style: solid; border-bottom-color: #cccccc; font-weight: normal; font-style: inherit; font-size: 1.5em; font-family: inherit; color: #222222;"&gt;Add a PageFooter&lt;/H2&gt;&lt;P&gt;&lt;IMG alt="Add-a-PageFooter.png" class="image-4 jive-image" src="https://community.qlik.com/legacyfs/online/107234_Add-a-PageFooter.png" style="height: auto;" /&gt;&lt;/P&gt;&lt;OL style="margin: 0 1.5em 1.5em; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;LI&gt;Right-click on the &lt;STRONG&gt;empty&lt;/STRONG&gt; area in the footer of the page&lt;/LI&gt;&lt;LI&gt;Select &lt;STRONG&gt;Insert Band&lt;/STRONG&gt;&lt;/LI&gt;&lt;LI&gt;Choose &lt;STRONG&gt;PageFooter&lt;/STRONG&gt; from the list.&lt;/LI&gt;&lt;/OL&gt;&lt;H2 class="step-title" style="margin: 0 0 0.75em; border-bottom-style: solid; border-bottom-color: #cccccc; font-weight: normal; font-style: inherit; font-size: 1.5em; font-family: inherit; color: #222222;"&gt;Fill-in the PageFooter&lt;/H2&gt;&lt;P&gt;&lt;IMG alt="Fill-in-the-PageFooter.png" class="image-5 jive-image" src="https://community.qlik.com/legacyfs/online/107235_Fill-in-the-PageFooter.png" style="height: auto;" /&gt;&lt;/P&gt;&lt;OL style="margin: 0 1.5em 1.5em; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;LI&gt;From the &lt;STRONG&gt;Tool Box&lt;/STRONG&gt; window, select &lt;STRONG&gt;Label &lt;/STRONG&gt;and "drag-and-drop" it&lt;/LI&gt;&lt;LI&gt;Create six new &lt;STRONG&gt;Labels&lt;/STRONG&gt; inside the &lt;STRONG&gt;PageFooter&lt;/STRONG&gt; and rename the first three. Format these &lt;STRONG&gt;Labels&lt;/STRONG&gt; as you prefer.&lt;/LI&gt;&lt;/OL&gt;&lt;H2 class="step-title" style="margin: 0 0 0.75em; border-bottom-style: solid; border-bottom-color: #cccccc; font-weight: normal; font-style: inherit; font-size: 1.5em; font-family: inherit; color: #222222;"&gt;Set Data Binding&lt;/H2&gt;&lt;P&gt;&lt;IMG alt="Set-Data-Binding.png" class="jive-image image-6" src="https://community.qlik.com/legacyfs/online/107236_Set-Data-Binding.png" style="height: auto;" /&gt;&lt;/P&gt;&lt;OL style="margin: 0 1.5em 1.5em; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;LI&gt;Select the &lt;STRONG&gt;Label&lt;/STRONG&gt;&lt;/LI&gt;&lt;LI&gt;Click on the &lt;STRONG&gt;smart tag&lt;/STRONG&gt; ("&amp;gt;") button on the upper part of the selected &lt;STRONG&gt;Label&lt;/STRONG&gt;&lt;/LI&gt;&lt;LI&gt;Select the&lt;STRONG&gt; Total Sales&lt;/STRONG&gt; field from the drop-down menu in the &lt;STRONG&gt;Data Binding&lt;/STRONG&gt; section.&lt;/LI&gt;&lt;/OL&gt;&lt;DIV class="step-container" style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;SPAN style="font-style: inherit; font-family: inherit; margin: 0 0 1.5em; font-weight: inherit;"&gt;Do these steps for the other two labels.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="step-container" style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;SPAN style="font-style: inherit; font-family: inherit; margin: 0 0 1.5em; font-weight: inherit;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;H2 class="step-title" style="margin: 0 0 0.75em; border-bottom-style: solid; border-bottom-color: #cccccc; font-weight: normal; font-style: inherit; font-size: 1.5em; font-family: inherit; color: #222222;"&gt;Set Format String&lt;/H2&gt;&lt;P&gt;&lt;IMG alt="Set-Format-String.png" class="jive-image image-7" src="https://community.qlik.com/legacyfs/online/107237_Set-Format-String.png" style="height: auto;" /&gt;&lt;/P&gt;&lt;OL style="margin: 0 1.5em 1.5em; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;LI&gt;Click on the &lt;STRONG&gt;smart tag&lt;/STRONG&gt; ("&amp;gt;")&lt;/LI&gt;&lt;LI&gt;Click on the &lt;STRONG&gt;browse&lt;/STRONG&gt; button at the far right end of the &lt;STRONG&gt;Format String&lt;/STRONG&gt; field to open the &lt;STRONG&gt;FormatString Editor&lt;/STRONG&gt;.&lt;/LI&gt;&lt;LI&gt;Select &lt;STRONG&gt;Currency&lt;/STRONG&gt; on the left side of the window&lt;/LI&gt;&lt;LI&gt;Select &lt;STRONG&gt;$0.00&lt;/STRONG&gt; from the list&lt;/LI&gt;&lt;LI&gt;Click &lt;STRONG&gt;OK&lt;/STRONG&gt;.&lt;/LI&gt;&lt;/OL&gt;&lt;DIV class="step-container" style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;SPAN style="font-style: inherit; font-family: inherit; margin: 0 0 1.5em; font-weight: inherit;"&gt;Do these steps for the other two labels.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="step-container" style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;SPAN style="font-style: inherit; font-family: inherit; margin: 0 0 1.5em; font-weight: inherit;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;H2 class="step-title" style="margin: 0 0 0.75em; border-bottom-style: solid; border-bottom-color: #cccccc; font-weight: normal; font-style: inherit; font-size: 1.5em; font-family: inherit; color: #222222;"&gt;Select the Script Language&lt;/H2&gt;&lt;P&gt;&lt;IMG alt="Select-the-Script-Language.png" class="image-8 jive-image" src="https://community.qlik.com/legacyfs/online/107238_Select-the-Script-Language.png" style="height: auto;" /&gt;&lt;/P&gt;&lt;OL style="margin: 0 1.5em 1.5em; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;LI&gt;Click on&lt;STRONG&gt; Report Explorer&lt;/STRONG&gt;&lt;/LI&gt;&lt;LI&gt;Select the&lt;STRONG&gt; C#&lt;/STRONG&gt; field from the drop-down menu in the &lt;STRONG&gt;Scripts&lt;/STRONG&gt; section&lt;/LI&gt;&lt;/OL&gt;&lt;H2 class="step-title" style="margin: 0 0 0.75em; border-bottom-style: solid; border-bottom-color: #cccccc; font-weight: normal; font-style: inherit; font-size: 1.5em; font-family: inherit; color: #222222;"&gt;Create the Script&lt;/H2&gt;&lt;P class="step-image-container" style="margin: 0 0 1em; padding: 5px; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;IMG alt="Create-the-Script.png" class="image-9 jive-image" src="https://community.qlik.com/legacyfs/online/107239_Create-the-Script.png" style="height: auto;" /&gt;&lt;/P&gt;&lt;OL style="margin: 0 1.5em 1.5em; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;LI&gt;Click on &lt;STRONG&gt;Script&lt;/STRONG&gt; on the upper-right side of the window.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="step-container" style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;/P&gt;&lt;H2 class="step-title" style="margin: 0 0 0.75em; border-bottom-style: solid; border-bottom-color: #cccccc; font-weight: normal; font-style: inherit; font-size: 1.5em; font-family: inherit; color: #222222;"&gt;C# Script: Variable Declaration&lt;/H2&gt;&lt;DIV class="step-image-container" style="margin: 0 0 1em; padding: 5px; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;P&gt;&lt;/P&gt;&lt;DIV class="step-image-container" style="margin: 0 0 1em; padding: 5px; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;IMG alt="C--Script--Variable-Declaration.png" class="image-10 jive-image" src="https://community.qlik.com/legacyfs/online/107240_C--Script--Variable-Declaration.png" style="height: auto;" /&gt;&lt;/DIV&gt;&lt;DIV class="step-image-container" style="margin: 0 0 1em; padding: 5px; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;CODE style="color: inherit;"&gt;using System.Collections.Generic; double currentPageTotal = 0; double runningPagesTotal = 0; int PageNumber = 0; List&amp;lt;double&amp;gt;PageTotal=new List&amp;lt;double&amp;gt;();&lt;/CODE&gt;&lt;/DIV&gt;&lt;P style="margin: 0 0 1.5em; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;Add the&lt;STRONG&gt; System.Collections.Generic&lt;/STRONG&gt; namespace to use &lt;STRONG&gt;Lists&lt;/STRONG&gt;.&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;STRONG&gt;currentPageTotal&lt;/STRONG&gt;: Total Sales on the current page&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;runningPagesTotal&lt;/STRONG&gt;: Total Sales of all pages&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;PageNumber&lt;/STRONG&gt;: Page counter&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;PageTotal&lt;/STRONG&gt;: List with the total of each single page.&lt;/LI&gt;&lt;/UL&gt;Copy and paste this code inside the &lt;STRONG&gt;Script Editor&lt;/STRONG&gt;.&lt;/DIV&gt;&lt;P class="step-container" style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;/P&gt;&lt;H2 class="step-title" style="margin: 0 0 0.75em; border-bottom-style: solid; border-bottom-color: #cccccc; font-weight: normal; font-style: inherit; font-size: 1.5em; font-family: inherit; color: #222222;"&gt;C# Script: OnSummaryReset Subroutine&lt;/H2&gt;&lt;P&gt;&lt;IMG alt="C--Script--OnSummaryReset-Subroutine.png" class="jive-image image-11" src="https://community.qlik.com/legacyfs/online/107241_C--Script--OnSummaryReset-Subroutine.png" style="height: auto;" /&gt;&lt;/P&gt;&lt;DIV class="step-image-container" style="margin: 0 0 1em; padding: 5px; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE style="padding: 9.5px; margin: 0 0 10px; font-size: 13px; border-left-width: 1px; background-color: #f5f5f5;"&gt;&lt;CODE style="color: inherit;"&gt;private void OnSummaryReset_currentPageTotal(object sender, System.EventArgs e) { PageTotal.Add(currentPageTotal); currentPageTotal=0; }&lt;/CODE&gt;&lt;/PRE&gt;&lt;P style="margin: 0 0 1.5em; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;This sub-routine is executed at the beginning of each new page.&lt;/P&gt;&lt;P style="margin: 0 0 1.5em; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;Code:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Add the &lt;STRONG&gt;currentPageTotal&lt;/STRONG&gt; value to the list&lt;/LI&gt;&lt;LI&gt;Save the &lt;STRONG&gt;currentPageTotal&lt;/STRONG&gt; value inside the list and reset its value.&lt;/LI&gt;&lt;/UL&gt;Add this code below the previous code.&lt;/DIV&gt;&lt;P class="step-container" style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;/P&gt;&lt;H2 class="step-title" style="margin: 0 0 0.75em; border-bottom-style: solid; border-bottom-color: #cccccc; font-weight: normal; font-style: inherit; font-size: 1.5em; font-family: inherit; color: #222222;"&gt;C# Script: OnSummaryRowChanged&lt;/H2&gt;&lt;P&gt;&lt;IMG alt="C--Script--OnSummaryRowChanged.png" class="jive-image image-12" src="https://community.qlik.com/legacyfs/online/107242_C--Script--OnSummaryRowChanged.png" style="height: auto;" /&gt;&lt;/P&gt;&lt;DIV class="step-image-container" style="margin: 0 0 1em; padding: 5px; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE style="padding: 9.5px; margin: 0 0 10px; font-size: 13px; border-left-width: 1px; background-color: #f5f5f5;"&gt;&lt;CODE style="color: inherit;"&gt;private void OnSummaryRowChanged_currentPageTotal(object sender, System.EventArgs e) { currentPageTotal+=(double)DetailReport.GetCurrentColumnValue("Total Sales"); }&lt;/CODE&gt;&lt;/PRE&gt;&lt;P style="margin: 0 0 1.5em; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;This code is executed for each row on the page. It retrieves the value of the &lt;STRONG&gt;Total Sales&lt;/STRONG&gt; field and adds it to the previous total. Remember to change the field name if you want to re-use the code in another field.&lt;/P&gt;&lt;P style="margin: 0 0 1.5em; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;Add this code below the previous code.&lt;/P&gt;&lt;/DIV&gt;&lt;P class="step-container" style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;/P&gt;&lt;H2 class="step-title" style="margin: 0 0 0.75em; border-bottom-style: solid; border-bottom-color: #cccccc; font-weight: normal; font-style: inherit; font-size: 1.5em; font-family: inherit; color: #222222;"&gt;C# Script: OnSummaryGetResult Current Page&lt;/H2&gt;&lt;P&gt;&lt;IMG alt="C--Script--OnSummaryGetResult-Current-Page.png" class="image-13 jive-image" src="https://community.qlik.com/legacyfs/online/107244_C--Script--OnSummaryGetResult-Current-Page.png" style="height: auto;" /&gt;&lt;/P&gt;&lt;DIV class="step-image-container" style="margin: 0 0 1em; padding: 5px; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE style="padding: 9.5px; margin: 0 0 10px; font-size: 13px; border-left-width: 1px; background-color: #f5f5f5;"&gt;&lt;CODE style="color: inherit;"&gt;private void OnSummaryGetResult_currentPageTotal(object sender, DevExpress.XtraReports.UI.SummaryGetResultEventArgs e) { e.Result=currentPageTotal; e.Handled=true; }&lt;/CODE&gt;&lt;/PRE&gt;&lt;P style="margin: 0 0 1.5em; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;This code returns the sum for the current page. It is executed when changing pages. Add this code below the previous code.&lt;/P&gt;&lt;/DIV&gt;&lt;P class="step-container" style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;/P&gt;&lt;H2 class="step-title" style="margin: 0 0 0.75em; border-bottom-style: solid; border-bottom-color: #cccccc; font-weight: normal; font-style: inherit; font-size: 1.5em; font-family: inherit; color: #222222;"&gt;C# Script: OnSummaryGetResult Previous Page&lt;/H2&gt;&lt;P&gt;&lt;IMG alt="C--Script--OnSummaryGetResult-Previous-Page.png" class="image-14 jive-image" src="https://community.qlik.com/legacyfs/online/107245_C--Script--OnSummaryGetResult-Previous-Page.png" style="height: auto;" /&gt;&lt;/P&gt;&lt;DIV class="step-image-container" style="margin: 0 0 1em; padding: 5px; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE style="padding: 9.5px; margin: 0 0 10px; font-size: 13px; border-left-width: 1px; background-color: #f5f5f5;"&gt;&lt;CODE style="color: inherit;"&gt;private void OnSummaryGetResult_previousPageTotal(object sender, DevExpress.XtraReports.UI.SummaryGetResultEventArgs e) { e.Result=PageTotal[PageNumber]; e.Handled=true; PageNumber+=1; }&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin: 0 0 1.5em; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;This code returns the total for the previous page. Add this code below the previous code.&lt;/P&gt;&lt;/DIV&gt;&lt;P class="step-container" style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;/P&gt;&lt;H2 class="step-title" style="margin: 0 0 0.75em; border-bottom-style: solid; border-bottom-color: #cccccc; font-weight: normal; font-style: inherit; font-size: 1.5em; font-family: inherit; color: #222222;"&gt;C# Script: OnSummaryGetResult Total Sales&lt;/H2&gt;&lt;P&gt;&lt;IMG alt="C--Script--OnSummaryGetResult-Total-Sales.png" class="jive-image image-15" src="https://community.qlik.com/legacyfs/online/107246_C--Script--OnSummaryGetResult-Total-Sales.png" style="height: auto;" /&gt;&lt;/P&gt;&lt;DIV class="step-image-container" style="margin: 0 0 1em; padding: 5px; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE style="padding: 9.5px; margin: 0 0 10px; font-size: 13px; border-left-width: 1px; background-color: #f5f5f5;"&gt;&lt;CODE style="color: inherit;"&gt;private void OnSummaryGetResult_runningPagesTotal(object sender, DevExpress.XtraReports.UI.SummaryGetResultEventArgs e) { runningPagesTotal+=currentPageTotal; e.Result=runningPagesTotal; e.Handled=true; }&lt;/CODE&gt;&lt;/PRE&gt;&lt;P style="margin: 0 0 1.5em; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;This code increases the value of &lt;STRONG&gt;runningPagesTotal&lt;/STRONG&gt; by the &lt;STRONG&gt;currentPageTotal&lt;/STRONG&gt; and returns the value of the Total Sales for each preceding page. Add this code below the previous code.&lt;/P&gt;&lt;/DIV&gt;&lt;P class="step-container" style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;/P&gt;&lt;H2 class="step-title" style="margin: 0 0 0.75em; border-bottom-style: solid; border-bottom-color: #cccccc; font-weight: normal; font-style: inherit; font-size: 1.5em; font-family: inherit; color: #222222;"&gt;Associate the Sub-routines to the Events to Calculate Current Page Total&lt;/H2&gt;&lt;P&gt;&lt;IMG alt="Associate-the-Sub-routines-to-the-Events-to-Calcul.png" class="jive-image image-16" src="https://community.qlik.com/legacyfs/online/107247_Associate-the-Sub-routines-to-the-Events-to-Calcul.png" style="height: auto;" /&gt;&lt;/P&gt;&lt;DIV class="step-image-container" style="margin: 0 0 1em; padding: 5px; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin: 0 0 1.5em; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;Now we associate sub-routines to the events specified on the left column.&lt;/P&gt;&lt;OL style="margin: 0 1.5em 1.5em; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;LI&gt;Select the first &lt;STRONG&gt;Label&lt;/STRONG&gt;&lt;/LI&gt;&lt;LI&gt;On&lt;STRONG&gt; Property Grid, &lt;/STRONG&gt;expand the &lt;STRONG&gt;Scripts&lt;/STRONG&gt; section&lt;/LI&gt;&lt;LI&gt;Insert:&lt;/LI&gt;&lt;/OL&gt;&lt;UL&gt;&lt;LI&gt;&lt;STRONG&gt;OnSummaryGetResult_currentPageTotal &lt;/STRONG&gt;on &lt;STRONG&gt;Summary Get Result &lt;/STRONG&gt;field.&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;OnSummaryReset_currentPageTotal &lt;/STRONG&gt;on &lt;STRONG&gt;Summary Reset &lt;/STRONG&gt;field&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;OnSummaryRowChanged_currentPageTotal &lt;/STRONG&gt;on &lt;STRONG&gt;Summary Row Change &lt;/STRONG&gt;field.&lt;/LI&gt;&lt;/UL&gt;&lt;/DIV&gt;&lt;H2 class="step-title" style="margin: 0 0 0.75em; border-bottom-style: solid; border-bottom-color: #cccccc; font-weight: normal; font-style: inherit; font-size: 1.5em; font-family: inherit; color: #222222;"&gt;Associate the Sub-routines to the Events to Calculate Preceding Page Total&lt;/H2&gt;&lt;P class="step-image-container" style="margin: 0 0 1em; padding: 5px; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;IMG alt="Associate-the-Sub-routines-to-the-Events-to-Calcul-1.png" class="image-17 jive-image" src="https://community.qlik.com/legacyfs/online/107248_Associate-the-Sub-routines-to-the-Events-to-Calcul-1.png" style="height: auto;" /&gt;&lt;/P&gt;&lt;OL style="margin: 0 1.5em 1.5em; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;LI&gt;Select the second &lt;STRONG&gt;Label&lt;/STRONG&gt;&lt;/LI&gt;&lt;LI&gt;On &lt;STRONG&gt;Property Grid,&lt;/STRONG&gt; expand the &lt;STRONG&gt;Scripts&lt;/STRONG&gt; section&lt;/LI&gt;&lt;LI&gt;Insert:&lt;/LI&gt;&lt;/OL&gt;&lt;UL&gt;&lt;LI&gt;&lt;STRONG&gt;OnSummaryGetResult_previousPageTotal &lt;/STRONG&gt;on &lt;STRONG&gt;Summary Get Result &lt;/STRONG&gt;field.&lt;/LI&gt;&lt;/UL&gt;&lt;P style="margin: 0 0 1.5em; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;Do these steps also for the last Label. Insert &lt;STRONG&gt;OnSummaryGetResult_runningPagesTotal &lt;/STRONG&gt;on &lt;STRONG&gt;Summary Get Result &lt;/STRONG&gt;field.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="step-container" style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;/P&gt;&lt;H2 class="step-title" style="margin: 0 0 0.75em; border-bottom-style: solid; border-bottom-color: #cccccc; font-weight: normal; font-style: inherit; font-size: 1.5em; font-family: inherit; color: #222222;"&gt;Generate Preview&lt;/H2&gt;&lt;P&gt;&lt;IMG alt="Generate-Preview.png" class="image-18 jive-image" src="https://community.qlik.com/legacyfs/online/107249_Generate-Preview.png" style="height: auto;" /&gt;&lt;/P&gt;&lt;DIV class="step-image-container" style="margin: 0 0 1em; padding: 5px; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin: 0 0 1.5em; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;Select &lt;STRONG&gt;Preview&lt;/STRONG&gt; in the &lt;STRONG&gt;Actions&lt;/STRONG&gt; group in the &lt;STRONG&gt;Reports&lt;/STRONG&gt; window&lt;/P&gt;&lt;/DIV&gt;&lt;P class="step-container" style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;/P&gt;&lt;H2 class="step-title" style="margin: 0 0 0.75em; border-bottom-style: solid; border-bottom-color: #cccccc; font-weight: normal; font-style: inherit; font-size: 1.5em; font-family: inherit; color: #222222;"&gt;The Result&lt;/H2&gt;&lt;P&gt;&lt;IMG alt="The-Result.png" class="jive-image image-19" src="https://community.qlik.com/legacyfs/online/107250_The-Result.png" style="height: auto;" /&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 25 Nov 2015 22:14:20 GMT</pubDate>
    <dc:creator>Frank_S</dc:creator>
    <dc:date>2015-11-25T22:14:20Z</dc:date>
    <item>
      <title>How to Create Previous Page Totals with PixelPerfect C# Scripts</title>
      <link>https://community.qlik.com/t5/Member-Articles/How-to-Create-Previous-Page-Totals-with-PixelPerfect-C-Scripts/ta-p/1483526</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;H1 class="article-title" style="margin: 0 0 0.5em; font-weight: normal; font-size: 2.5em; font-family: 'Times New Roman'; color: #222222;"&gt;&lt;/H1&gt;&lt;P style="margin: 0 0 1.5em; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;STRONG&gt;Description&lt;/STRONG&gt;: This tutorial illustrates how create a PixelPerfect Report with C# &lt;STRONG&gt;Scripts&lt;/STRONG&gt;. This Report calculates previous page totals using macros. You can use C#, Visual Basic or JavaScript to develop PixelPerfect Scripts. For a Visual Basic version of this tutorial refer to "&lt;SPAN style="color: #000099; font-style: inherit; font-family: inherit; text-decoration: underline; font-weight: inherit;"&gt;&lt;A _jive_internal="true" href="https://community.qlik.com/docs/DOC-14038"&gt;How to Create Previous Page Totals with PixelPerfect Visual Basic Scripts&lt;/A&gt;&lt;/SPAN&gt;".&lt;/P&gt;&lt;P style="font-size: 14px; font-family: 'Times New Roman'; color: #333333;"&gt;&lt;/P&gt;&lt;DIV class="step-container" style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;H2 class="step-title" style="margin: 0 0 0.75em; border-bottom-style: solid; border-bottom-color: #cccccc; font-weight: normal; font-style: inherit; font-size: 1.5em; font-family: inherit; color: #222222;"&gt;Create a New PixelPerfect Report&lt;/H2&gt;&lt;DIV class="step-image-container" style="margin: 0 0 1em; padding: 5px; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Create-a-New-PixelPerfect-Report.png" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/107225_Create-a-New-PixelPerfect-Report.png" style="height: auto;" /&gt;&lt;/P&gt;&lt;OL style="margin: 0 1.5em 1.5em; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;LI&gt;Select &lt;STRONG&gt;Reports&lt;/STRONG&gt; in the lower left-hand panel&lt;/LI&gt;&lt;LI&gt;Select the &lt;STRONG&gt;PixelPerfect report&lt;/STRONG&gt; type in the panel just above&lt;/LI&gt;&lt;LI&gt;Select &lt;STRONG&gt;PixelPerfect&lt;/STRONG&gt;&lt;STRONG&gt;Report&lt;/STRONG&gt; in the &lt;STRONG&gt;New&lt;/STRONG&gt; group of the tool bar.&lt;/LI&gt;&lt;/OL&gt;&lt;/DIV&gt;&lt;H2 class="step-title" style="margin: 0 0 0.75em; border-bottom-style: solid; border-bottom-color: #cccccc; font-weight: normal; font-style: inherit; font-size: 1.5em; font-family: inherit; color: #222222;"&gt;Name the Report&lt;/H2&gt;&lt;P&gt;&lt;IMG alt="Name-the-Report.png" class="jive-image image-2" src="https://community.qlik.com/legacyfs/online/107226_Name-the-Report.png" style="height: auto;" /&gt;&lt;/P&gt;&lt;OL style="margin: 0 1.5em 1.5em; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;LI&gt;Enter "&lt;STRONG&gt;PixelPerfect Previous Page Total with C# Script" &lt;/STRONG&gt;as name for your report&lt;/LI&gt;&lt;LI&gt;Select &lt;STRONG&gt;New&lt;/STRONG&gt; in the &lt;STRONG&gt;Template&lt;/STRONG&gt; group of the tool bar.&lt;/LI&gt;&lt;/OL&gt;&lt;H2 class="step-title" style="margin: 0 0 0.75em; border-bottom-style: solid; border-bottom-color: #cccccc; font-weight: normal; font-style: inherit; font-size: 1.5em; font-family: inherit; color: #222222;"&gt;Create a Table&lt;/H2&gt;&lt;P&gt;&lt;IMG alt="Create-a-Table.png" class="jive-image image-3" src="https://community.qlik.com/legacyfs/online/107227_Create-a-Table.png" style="height: auto;" /&gt;&lt;/P&gt;&lt;OL style="margin: 0 1.5em 1.5em; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;LI&gt;Add &lt;STRONG&gt;CH294&lt;/STRONG&gt; as a Level. For more explanation on the Level creation please refer to "&lt;A _jive_internal="true" href="https://community.qlik.com/docs/DOC-8405"&gt;How to Create a Simple PixelPerfect Report&lt;/A&gt;"&lt;/LI&gt;&lt;LI&gt;Create the table into the report. Don't insert any column totals.&lt;/LI&gt;&lt;/OL&gt;&lt;H2 class="step-title" style="margin: 0 0 0.75em; border-bottom-style: solid; border-bottom-color: #cccccc; font-weight: normal; font-style: inherit; font-size: 1.5em; font-family: inherit; color: #222222;"&gt;Add a PageFooter&lt;/H2&gt;&lt;P&gt;&lt;IMG alt="Add-a-PageFooter.png" class="image-4 jive-image" src="https://community.qlik.com/legacyfs/online/107234_Add-a-PageFooter.png" style="height: auto;" /&gt;&lt;/P&gt;&lt;OL style="margin: 0 1.5em 1.5em; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;LI&gt;Right-click on the &lt;STRONG&gt;empty&lt;/STRONG&gt; area in the footer of the page&lt;/LI&gt;&lt;LI&gt;Select &lt;STRONG&gt;Insert Band&lt;/STRONG&gt;&lt;/LI&gt;&lt;LI&gt;Choose &lt;STRONG&gt;PageFooter&lt;/STRONG&gt; from the list.&lt;/LI&gt;&lt;/OL&gt;&lt;H2 class="step-title" style="margin: 0 0 0.75em; border-bottom-style: solid; border-bottom-color: #cccccc; font-weight: normal; font-style: inherit; font-size: 1.5em; font-family: inherit; color: #222222;"&gt;Fill-in the PageFooter&lt;/H2&gt;&lt;P&gt;&lt;IMG alt="Fill-in-the-PageFooter.png" class="image-5 jive-image" src="https://community.qlik.com/legacyfs/online/107235_Fill-in-the-PageFooter.png" style="height: auto;" /&gt;&lt;/P&gt;&lt;OL style="margin: 0 1.5em 1.5em; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;LI&gt;From the &lt;STRONG&gt;Tool Box&lt;/STRONG&gt; window, select &lt;STRONG&gt;Label &lt;/STRONG&gt;and "drag-and-drop" it&lt;/LI&gt;&lt;LI&gt;Create six new &lt;STRONG&gt;Labels&lt;/STRONG&gt; inside the &lt;STRONG&gt;PageFooter&lt;/STRONG&gt; and rename the first three. Format these &lt;STRONG&gt;Labels&lt;/STRONG&gt; as you prefer.&lt;/LI&gt;&lt;/OL&gt;&lt;H2 class="step-title" style="margin: 0 0 0.75em; border-bottom-style: solid; border-bottom-color: #cccccc; font-weight: normal; font-style: inherit; font-size: 1.5em; font-family: inherit; color: #222222;"&gt;Set Data Binding&lt;/H2&gt;&lt;P&gt;&lt;IMG alt="Set-Data-Binding.png" class="jive-image image-6" src="https://community.qlik.com/legacyfs/online/107236_Set-Data-Binding.png" style="height: auto;" /&gt;&lt;/P&gt;&lt;OL style="margin: 0 1.5em 1.5em; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;LI&gt;Select the &lt;STRONG&gt;Label&lt;/STRONG&gt;&lt;/LI&gt;&lt;LI&gt;Click on the &lt;STRONG&gt;smart tag&lt;/STRONG&gt; ("&amp;gt;") button on the upper part of the selected &lt;STRONG&gt;Label&lt;/STRONG&gt;&lt;/LI&gt;&lt;LI&gt;Select the&lt;STRONG&gt; Total Sales&lt;/STRONG&gt; field from the drop-down menu in the &lt;STRONG&gt;Data Binding&lt;/STRONG&gt; section.&lt;/LI&gt;&lt;/OL&gt;&lt;DIV class="step-container" style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;SPAN style="font-style: inherit; font-family: inherit; margin: 0 0 1.5em; font-weight: inherit;"&gt;Do these steps for the other two labels.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="step-container" style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;SPAN style="font-style: inherit; font-family: inherit; margin: 0 0 1.5em; font-weight: inherit;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;H2 class="step-title" style="margin: 0 0 0.75em; border-bottom-style: solid; border-bottom-color: #cccccc; font-weight: normal; font-style: inherit; font-size: 1.5em; font-family: inherit; color: #222222;"&gt;Set Format String&lt;/H2&gt;&lt;P&gt;&lt;IMG alt="Set-Format-String.png" class="jive-image image-7" src="https://community.qlik.com/legacyfs/online/107237_Set-Format-String.png" style="height: auto;" /&gt;&lt;/P&gt;&lt;OL style="margin: 0 1.5em 1.5em; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;LI&gt;Click on the &lt;STRONG&gt;smart tag&lt;/STRONG&gt; ("&amp;gt;")&lt;/LI&gt;&lt;LI&gt;Click on the &lt;STRONG&gt;browse&lt;/STRONG&gt; button at the far right end of the &lt;STRONG&gt;Format String&lt;/STRONG&gt; field to open the &lt;STRONG&gt;FormatString Editor&lt;/STRONG&gt;.&lt;/LI&gt;&lt;LI&gt;Select &lt;STRONG&gt;Currency&lt;/STRONG&gt; on the left side of the window&lt;/LI&gt;&lt;LI&gt;Select &lt;STRONG&gt;$0.00&lt;/STRONG&gt; from the list&lt;/LI&gt;&lt;LI&gt;Click &lt;STRONG&gt;OK&lt;/STRONG&gt;.&lt;/LI&gt;&lt;/OL&gt;&lt;DIV class="step-container" style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;SPAN style="font-style: inherit; font-family: inherit; margin: 0 0 1.5em; font-weight: inherit;"&gt;Do these steps for the other two labels.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="step-container" style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;SPAN style="font-style: inherit; font-family: inherit; margin: 0 0 1.5em; font-weight: inherit;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;H2 class="step-title" style="margin: 0 0 0.75em; border-bottom-style: solid; border-bottom-color: #cccccc; font-weight: normal; font-style: inherit; font-size: 1.5em; font-family: inherit; color: #222222;"&gt;Select the Script Language&lt;/H2&gt;&lt;P&gt;&lt;IMG alt="Select-the-Script-Language.png" class="image-8 jive-image" src="https://community.qlik.com/legacyfs/online/107238_Select-the-Script-Language.png" style="height: auto;" /&gt;&lt;/P&gt;&lt;OL style="margin: 0 1.5em 1.5em; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;LI&gt;Click on&lt;STRONG&gt; Report Explorer&lt;/STRONG&gt;&lt;/LI&gt;&lt;LI&gt;Select the&lt;STRONG&gt; C#&lt;/STRONG&gt; field from the drop-down menu in the &lt;STRONG&gt;Scripts&lt;/STRONG&gt; section&lt;/LI&gt;&lt;/OL&gt;&lt;H2 class="step-title" style="margin: 0 0 0.75em; border-bottom-style: solid; border-bottom-color: #cccccc; font-weight: normal; font-style: inherit; font-size: 1.5em; font-family: inherit; color: #222222;"&gt;Create the Script&lt;/H2&gt;&lt;P class="step-image-container" style="margin: 0 0 1em; padding: 5px; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;IMG alt="Create-the-Script.png" class="image-9 jive-image" src="https://community.qlik.com/legacyfs/online/107239_Create-the-Script.png" style="height: auto;" /&gt;&lt;/P&gt;&lt;OL style="margin: 0 1.5em 1.5em; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;LI&gt;Click on &lt;STRONG&gt;Script&lt;/STRONG&gt; on the upper-right side of the window.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="step-container" style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;/P&gt;&lt;H2 class="step-title" style="margin: 0 0 0.75em; border-bottom-style: solid; border-bottom-color: #cccccc; font-weight: normal; font-style: inherit; font-size: 1.5em; font-family: inherit; color: #222222;"&gt;C# Script: Variable Declaration&lt;/H2&gt;&lt;DIV class="step-image-container" style="margin: 0 0 1em; padding: 5px; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;P&gt;&lt;/P&gt;&lt;DIV class="step-image-container" style="margin: 0 0 1em; padding: 5px; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;IMG alt="C--Script--Variable-Declaration.png" class="image-10 jive-image" src="https://community.qlik.com/legacyfs/online/107240_C--Script--Variable-Declaration.png" style="height: auto;" /&gt;&lt;/DIV&gt;&lt;DIV class="step-image-container" style="margin: 0 0 1em; padding: 5px; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;CODE style="color: inherit;"&gt;using System.Collections.Generic; double currentPageTotal = 0; double runningPagesTotal = 0; int PageNumber = 0; List&amp;lt;double&amp;gt;PageTotal=new List&amp;lt;double&amp;gt;();&lt;/CODE&gt;&lt;/DIV&gt;&lt;P style="margin: 0 0 1.5em; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;Add the&lt;STRONG&gt; System.Collections.Generic&lt;/STRONG&gt; namespace to use &lt;STRONG&gt;Lists&lt;/STRONG&gt;.&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;STRONG&gt;currentPageTotal&lt;/STRONG&gt;: Total Sales on the current page&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;runningPagesTotal&lt;/STRONG&gt;: Total Sales of all pages&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;PageNumber&lt;/STRONG&gt;: Page counter&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;PageTotal&lt;/STRONG&gt;: List with the total of each single page.&lt;/LI&gt;&lt;/UL&gt;Copy and paste this code inside the &lt;STRONG&gt;Script Editor&lt;/STRONG&gt;.&lt;/DIV&gt;&lt;P class="step-container" style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;/P&gt;&lt;H2 class="step-title" style="margin: 0 0 0.75em; border-bottom-style: solid; border-bottom-color: #cccccc; font-weight: normal; font-style: inherit; font-size: 1.5em; font-family: inherit; color: #222222;"&gt;C# Script: OnSummaryReset Subroutine&lt;/H2&gt;&lt;P&gt;&lt;IMG alt="C--Script--OnSummaryReset-Subroutine.png" class="jive-image image-11" src="https://community.qlik.com/legacyfs/online/107241_C--Script--OnSummaryReset-Subroutine.png" style="height: auto;" /&gt;&lt;/P&gt;&lt;DIV class="step-image-container" style="margin: 0 0 1em; padding: 5px; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE style="padding: 9.5px; margin: 0 0 10px; font-size: 13px; border-left-width: 1px; background-color: #f5f5f5;"&gt;&lt;CODE style="color: inherit;"&gt;private void OnSummaryReset_currentPageTotal(object sender, System.EventArgs e) { PageTotal.Add(currentPageTotal); currentPageTotal=0; }&lt;/CODE&gt;&lt;/PRE&gt;&lt;P style="margin: 0 0 1.5em; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;This sub-routine is executed at the beginning of each new page.&lt;/P&gt;&lt;P style="margin: 0 0 1.5em; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;Code:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Add the &lt;STRONG&gt;currentPageTotal&lt;/STRONG&gt; value to the list&lt;/LI&gt;&lt;LI&gt;Save the &lt;STRONG&gt;currentPageTotal&lt;/STRONG&gt; value inside the list and reset its value.&lt;/LI&gt;&lt;/UL&gt;Add this code below the previous code.&lt;/DIV&gt;&lt;P class="step-container" style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;/P&gt;&lt;H2 class="step-title" style="margin: 0 0 0.75em; border-bottom-style: solid; border-bottom-color: #cccccc; font-weight: normal; font-style: inherit; font-size: 1.5em; font-family: inherit; color: #222222;"&gt;C# Script: OnSummaryRowChanged&lt;/H2&gt;&lt;P&gt;&lt;IMG alt="C--Script--OnSummaryRowChanged.png" class="jive-image image-12" src="https://community.qlik.com/legacyfs/online/107242_C--Script--OnSummaryRowChanged.png" style="height: auto;" /&gt;&lt;/P&gt;&lt;DIV class="step-image-container" style="margin: 0 0 1em; padding: 5px; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE style="padding: 9.5px; margin: 0 0 10px; font-size: 13px; border-left-width: 1px; background-color: #f5f5f5;"&gt;&lt;CODE style="color: inherit;"&gt;private void OnSummaryRowChanged_currentPageTotal(object sender, System.EventArgs e) { currentPageTotal+=(double)DetailReport.GetCurrentColumnValue("Total Sales"); }&lt;/CODE&gt;&lt;/PRE&gt;&lt;P style="margin: 0 0 1.5em; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;This code is executed for each row on the page. It retrieves the value of the &lt;STRONG&gt;Total Sales&lt;/STRONG&gt; field and adds it to the previous total. Remember to change the field name if you want to re-use the code in another field.&lt;/P&gt;&lt;P style="margin: 0 0 1.5em; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;Add this code below the previous code.&lt;/P&gt;&lt;/DIV&gt;&lt;P class="step-container" style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;/P&gt;&lt;H2 class="step-title" style="margin: 0 0 0.75em; border-bottom-style: solid; border-bottom-color: #cccccc; font-weight: normal; font-style: inherit; font-size: 1.5em; font-family: inherit; color: #222222;"&gt;C# Script: OnSummaryGetResult Current Page&lt;/H2&gt;&lt;P&gt;&lt;IMG alt="C--Script--OnSummaryGetResult-Current-Page.png" class="image-13 jive-image" src="https://community.qlik.com/legacyfs/online/107244_C--Script--OnSummaryGetResult-Current-Page.png" style="height: auto;" /&gt;&lt;/P&gt;&lt;DIV class="step-image-container" style="margin: 0 0 1em; padding: 5px; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE style="padding: 9.5px; margin: 0 0 10px; font-size: 13px; border-left-width: 1px; background-color: #f5f5f5;"&gt;&lt;CODE style="color: inherit;"&gt;private void OnSummaryGetResult_currentPageTotal(object sender, DevExpress.XtraReports.UI.SummaryGetResultEventArgs e) { e.Result=currentPageTotal; e.Handled=true; }&lt;/CODE&gt;&lt;/PRE&gt;&lt;P style="margin: 0 0 1.5em; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;This code returns the sum for the current page. It is executed when changing pages. Add this code below the previous code.&lt;/P&gt;&lt;/DIV&gt;&lt;P class="step-container" style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;/P&gt;&lt;H2 class="step-title" style="margin: 0 0 0.75em; border-bottom-style: solid; border-bottom-color: #cccccc; font-weight: normal; font-style: inherit; font-size: 1.5em; font-family: inherit; color: #222222;"&gt;C# Script: OnSummaryGetResult Previous Page&lt;/H2&gt;&lt;P&gt;&lt;IMG alt="C--Script--OnSummaryGetResult-Previous-Page.png" class="image-14 jive-image" src="https://community.qlik.com/legacyfs/online/107245_C--Script--OnSummaryGetResult-Previous-Page.png" style="height: auto;" /&gt;&lt;/P&gt;&lt;DIV class="step-image-container" style="margin: 0 0 1em; padding: 5px; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE style="padding: 9.5px; margin: 0 0 10px; font-size: 13px; border-left-width: 1px; background-color: #f5f5f5;"&gt;&lt;CODE style="color: inherit;"&gt;private void OnSummaryGetResult_previousPageTotal(object sender, DevExpress.XtraReports.UI.SummaryGetResultEventArgs e) { e.Result=PageTotal[PageNumber]; e.Handled=true; PageNumber+=1; }&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin: 0 0 1.5em; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;This code returns the total for the previous page. Add this code below the previous code.&lt;/P&gt;&lt;/DIV&gt;&lt;P class="step-container" style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;/P&gt;&lt;H2 class="step-title" style="margin: 0 0 0.75em; border-bottom-style: solid; border-bottom-color: #cccccc; font-weight: normal; font-style: inherit; font-size: 1.5em; font-family: inherit; color: #222222;"&gt;C# Script: OnSummaryGetResult Total Sales&lt;/H2&gt;&lt;P&gt;&lt;IMG alt="C--Script--OnSummaryGetResult-Total-Sales.png" class="jive-image image-15" src="https://community.qlik.com/legacyfs/online/107246_C--Script--OnSummaryGetResult-Total-Sales.png" style="height: auto;" /&gt;&lt;/P&gt;&lt;DIV class="step-image-container" style="margin: 0 0 1em; padding: 5px; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE style="padding: 9.5px; margin: 0 0 10px; font-size: 13px; border-left-width: 1px; background-color: #f5f5f5;"&gt;&lt;CODE style="color: inherit;"&gt;private void OnSummaryGetResult_runningPagesTotal(object sender, DevExpress.XtraReports.UI.SummaryGetResultEventArgs e) { runningPagesTotal+=currentPageTotal; e.Result=runningPagesTotal; e.Handled=true; }&lt;/CODE&gt;&lt;/PRE&gt;&lt;P style="margin: 0 0 1.5em; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;This code increases the value of &lt;STRONG&gt;runningPagesTotal&lt;/STRONG&gt; by the &lt;STRONG&gt;currentPageTotal&lt;/STRONG&gt; and returns the value of the Total Sales for each preceding page. Add this code below the previous code.&lt;/P&gt;&lt;/DIV&gt;&lt;P class="step-container" style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;/P&gt;&lt;H2 class="step-title" style="margin: 0 0 0.75em; border-bottom-style: solid; border-bottom-color: #cccccc; font-weight: normal; font-style: inherit; font-size: 1.5em; font-family: inherit; color: #222222;"&gt;Associate the Sub-routines to the Events to Calculate Current Page Total&lt;/H2&gt;&lt;P&gt;&lt;IMG alt="Associate-the-Sub-routines-to-the-Events-to-Calcul.png" class="jive-image image-16" src="https://community.qlik.com/legacyfs/online/107247_Associate-the-Sub-routines-to-the-Events-to-Calcul.png" style="height: auto;" /&gt;&lt;/P&gt;&lt;DIV class="step-image-container" style="margin: 0 0 1em; padding: 5px; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin: 0 0 1.5em; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;Now we associate sub-routines to the events specified on the left column.&lt;/P&gt;&lt;OL style="margin: 0 1.5em 1.5em; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;LI&gt;Select the first &lt;STRONG&gt;Label&lt;/STRONG&gt;&lt;/LI&gt;&lt;LI&gt;On&lt;STRONG&gt; Property Grid, &lt;/STRONG&gt;expand the &lt;STRONG&gt;Scripts&lt;/STRONG&gt; section&lt;/LI&gt;&lt;LI&gt;Insert:&lt;/LI&gt;&lt;/OL&gt;&lt;UL&gt;&lt;LI&gt;&lt;STRONG&gt;OnSummaryGetResult_currentPageTotal &lt;/STRONG&gt;on &lt;STRONG&gt;Summary Get Result &lt;/STRONG&gt;field.&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;OnSummaryReset_currentPageTotal &lt;/STRONG&gt;on &lt;STRONG&gt;Summary Reset &lt;/STRONG&gt;field&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;OnSummaryRowChanged_currentPageTotal &lt;/STRONG&gt;on &lt;STRONG&gt;Summary Row Change &lt;/STRONG&gt;field.&lt;/LI&gt;&lt;/UL&gt;&lt;/DIV&gt;&lt;H2 class="step-title" style="margin: 0 0 0.75em; border-bottom-style: solid; border-bottom-color: #cccccc; font-weight: normal; font-style: inherit; font-size: 1.5em; font-family: inherit; color: #222222;"&gt;Associate the Sub-routines to the Events to Calculate Preceding Page Total&lt;/H2&gt;&lt;P class="step-image-container" style="margin: 0 0 1em; padding: 5px; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;IMG alt="Associate-the-Sub-routines-to-the-Events-to-Calcul-1.png" class="image-17 jive-image" src="https://community.qlik.com/legacyfs/online/107248_Associate-the-Sub-routines-to-the-Events-to-Calcul-1.png" style="height: auto;" /&gt;&lt;/P&gt;&lt;OL style="margin: 0 1.5em 1.5em; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;LI&gt;Select the second &lt;STRONG&gt;Label&lt;/STRONG&gt;&lt;/LI&gt;&lt;LI&gt;On &lt;STRONG&gt;Property Grid,&lt;/STRONG&gt; expand the &lt;STRONG&gt;Scripts&lt;/STRONG&gt; section&lt;/LI&gt;&lt;LI&gt;Insert:&lt;/LI&gt;&lt;/OL&gt;&lt;UL&gt;&lt;LI&gt;&lt;STRONG&gt;OnSummaryGetResult_previousPageTotal &lt;/STRONG&gt;on &lt;STRONG&gt;Summary Get Result &lt;/STRONG&gt;field.&lt;/LI&gt;&lt;/UL&gt;&lt;P style="margin: 0 0 1.5em; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;Do these steps also for the last Label. Insert &lt;STRONG&gt;OnSummaryGetResult_runningPagesTotal &lt;/STRONG&gt;on &lt;STRONG&gt;Summary Get Result &lt;/STRONG&gt;field.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="step-container" style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;/P&gt;&lt;H2 class="step-title" style="margin: 0 0 0.75em; border-bottom-style: solid; border-bottom-color: #cccccc; font-weight: normal; font-style: inherit; font-size: 1.5em; font-family: inherit; color: #222222;"&gt;Generate Preview&lt;/H2&gt;&lt;P&gt;&lt;IMG alt="Generate-Preview.png" class="image-18 jive-image" src="https://community.qlik.com/legacyfs/online/107249_Generate-Preview.png" style="height: auto;" /&gt;&lt;/P&gt;&lt;DIV class="step-image-container" style="margin: 0 0 1em; padding: 5px; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin: 0 0 1.5em; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;Select &lt;STRONG&gt;Preview&lt;/STRONG&gt; in the &lt;STRONG&gt;Actions&lt;/STRONG&gt; group in the &lt;STRONG&gt;Reports&lt;/STRONG&gt; window&lt;/P&gt;&lt;/DIV&gt;&lt;P class="step-container" style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;/P&gt;&lt;H2 class="step-title" style="margin: 0 0 0.75em; border-bottom-style: solid; border-bottom-color: #cccccc; font-weight: normal; font-style: inherit; font-size: 1.5em; font-family: inherit; color: #222222;"&gt;The Result&lt;/H2&gt;&lt;P&gt;&lt;IMG alt="The-Result.png" class="jive-image image-19" src="https://community.qlik.com/legacyfs/online/107250_The-Result.png" style="height: auto;" /&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Nov 2015 22:14:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Member-Articles/How-to-Create-Previous-Page-Totals-with-PixelPerfect-C-Scripts/ta-p/1483526</guid>
      <dc:creator>Frank_S</dc:creator>
      <dc:date>2015-11-25T22:14:20Z</dc:date>
    </item>
  </channel>
</rss>

