<?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>Question Re: Crystal Reports - Issue With Shared Variables in Technology Q&amp;A</title>
    <link>https://community.sap.com/t5/technology-q-a/crystal-reports-issue-with-shared-variables/qaa-p/12106944#M4523230</link>
    <description>&lt;P&gt;Hi Seth,&lt;/P&gt;&lt;P&gt;Could you please try these:&lt;/P&gt;&lt;P&gt;1. Create a formula  @disp_shr to display the value of the shared variable on the Main Report's group:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;shared numbervar CountFS;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Place this on &lt;STRONG&gt;Group Footer#1.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;2. Create a reset formula and place this on the Group Header:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;shared numbervar CountFS := 0;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;3. Does the @disp_shr formula show the correct value for each group the subreport runs for?&lt;/P&gt;&lt;P&gt;4. If yes, modify the @disp_shr formula to:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;shared numbervar CountFS;
shared numbervar gtot;
gtot := gtot + CountFS;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;5. Create one final formula to display the grand total and place this on the Report Footer:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;shared numbervar gtot;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;-Abhilash&lt;/STRONG&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 26 Nov 2019 22:50:24 GMT</pubDate>
    <dc:creator>abhilash_kumar</dc:creator>
    <dc:date>2019-11-26T22:50:24Z</dc:date>
    <item>
      <title>Crystal Reports - Issue With Shared Variables</title>
      <link>https://community.sap.com/t5/technology-q-a/crystal-reports-issue-with-shared-variables/qaq-p/12106937</link>
      <description>&lt;P&gt;I am having an issue with shared variables that are going from my subreport to my main report. In my subreport I want to pass the sum of the formula ActualCFS and the count of field tbnatur.desc to my main report. I will focus on just one of these, as whatever the problem is with one seems to be the same problem with the other. In a nutshell, these formulas give me exactly what they should when they are on the subreport, so I feel they are working properly. The problem is that the value that is passed to the main report for both formulas are both exactly 554 short of what they each should be.&lt;/P&gt;
  &lt;P&gt;I have this formula in my subreport:&lt;/P&gt;
  &lt;PRE&gt;&lt;CODE&gt;Shared NumberVar CountCFS;
CountCFS := CountCFS + Sum ({@ActualCFS});
CountCFS;
&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;I have this formula in my main report:&lt;/P&gt;
  &lt;PRE&gt;&lt;CODE&gt;Shared NumberVar CountCFS;
CountCFS
&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;Again, when I place the formulas on the subreport they are correct. But the values on the main report are both short of what they should be by 554 and I absolutely cannot figure out why.&lt;/P&gt;</description>
      <pubDate>Tue, 26 Nov 2019 21:15:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/crystal-reports-issue-with-shared-variables/qaq-p/12106937</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2019-11-26T21:15:49Z</dc:date>
    </item>
    <item>
      <title>Re: Crystal Reports - Issue With Shared Variables</title>
      <link>https://community.sap.com/t5/technology-q-a/crystal-reports-issue-with-shared-variables/qaa-p/12106938#M4523224</link>
      <description>&lt;P&gt;1.  Are you initializing CountCFS to 0 in the main report before the first time the subreport is called?  The best way to do this would be in the report header section with a formula that looks like this:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;Shared NumberVar CountCFS := 0;
""&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The empty string at the end ensures that it doesn't display anything.&lt;/P&gt;&lt;P&gt;2.  What type of section are you displaying it in?  Is it AFTER all of the subreports have run?  The variable won't have a complete value until after they've all run.&lt;/P&gt;&lt;P&gt;3.  Try constraining which pass the variable is calculated in by making "WhilePrintingRecords;" the first line in all of the formulas.&lt;/P&gt;&lt;P&gt;-Dell&lt;/P&gt;</description>
      <pubDate>Tue, 26 Nov 2019 21:56:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/crystal-reports-issue-with-shared-variables/qaa-p/12106938#M4523224</guid>
      <dc:creator>DellSC</dc:creator>
      <dc:date>2019-11-26T21:56:20Z</dc:date>
    </item>
    <item>
      <title>Re: Crystal Reports - Issue With Shared Variables</title>
      <link>https://community.sap.com/t5/technology-q-a/crystal-reports-issue-with-shared-variables/qaa-p/12106939#M4523225</link>
      <description>&lt;P&gt;Hi Seth,&lt;/P&gt;&lt;P&gt;Which section is the Subreport in and which section is the shared formula on the Main Report in?&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;-Abhilash&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Nov 2019 22:02:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/crystal-reports-issue-with-shared-variables/qaa-p/12106939#M4523225</guid>
      <dc:creator>abhilash_kumar</dc:creator>
      <dc:date>2019-11-26T22:02:25Z</dc:date>
    </item>
    <item>
      <title>Re: Crystal Reports - Issue With Shared Variables</title>
      <link>https://community.sap.com/t5/technology-q-a/crystal-reports-issue-with-shared-variables/qaa-p/12106940#M4523226</link>
      <description>&lt;P&gt;The subreport is in Group Header #1 on the main report. The shared formula is in the Report Footer. &lt;/P&gt;</description>
      <pubDate>Tue, 26 Nov 2019 22:16:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/crystal-reports-issue-with-shared-variables/qaa-p/12106940#M4523226</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2019-11-26T22:16:35Z</dc:date>
    </item>
    <item>
      <title>Re: Crystal Reports - Issue With Shared Variables</title>
      <link>https://community.sap.com/t5/technology-q-a/crystal-reports-issue-with-shared-variables/qaa-p/12106941#M4523227</link>
      <description>&lt;P&gt;1. I have added this into the report header.&lt;/P&gt;&lt;P&gt;2. I do have the shared value after the subreport has ran. Again, it's passing a value, it's just 554 short of what it should be passing. I know the formula on the subreport end are good because all of the math is correct there. It just gets wonky on the main report.&lt;/P&gt;&lt;P&gt;3. Added WhilePrintingRecords;&lt;/P&gt;&lt;P&gt;Tried all of these suggestions and it is still displaying the incorrect value on the main report. &lt;/P&gt;</description>
      <pubDate>Tue, 26 Nov 2019 22:22:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/crystal-reports-issue-with-shared-variables/qaa-p/12106941#M4523227</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2019-11-26T22:22:54Z</dc:date>
    </item>
    <item>
      <title>Re: Crystal Reports - Issue With Shared Variables</title>
      <link>https://community.sap.com/t5/technology-q-a/crystal-reports-issue-with-shared-variables/qaa-p/12106942#M4523228</link>
      <description>&lt;P&gt;How many times does the subreport run and what type of section is the formula in on the subreport?&lt;/P&gt;&lt;P&gt;-Dell&lt;/P&gt;</description>
      <pubDate>Tue, 26 Nov 2019 22:28:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/crystal-reports-issue-with-shared-variables/qaa-p/12106942#M4523228</guid>
      <dc:creator>DellSC</dc:creator>
      <dc:date>2019-11-26T22:28:14Z</dc:date>
    </item>
    <item>
      <title>Re: Crystal Reports - Issue With Shared Variables</title>
      <link>https://community.sap.com/t5/technology-q-a/crystal-reports-issue-with-shared-variables/qaa-p/12106943#M4523229</link>
      <description>&lt;P&gt;The subreport only runs once. It is located in Group Header #1 in the main report. The formula is on the Report Footer in the subreport. &lt;/P&gt;</description>
      <pubDate>Tue, 26 Nov 2019 22:40:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/crystal-reports-issue-with-shared-variables/qaa-p/12106943#M4523229</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2019-11-26T22:40:44Z</dc:date>
    </item>
    <item>
      <title>Re: Crystal Reports - Issue With Shared Variables</title>
      <link>https://community.sap.com/t5/technology-q-a/crystal-reports-issue-with-shared-variables/qaa-p/12106944#M4523230</link>
      <description>&lt;P&gt;Hi Seth,&lt;/P&gt;&lt;P&gt;Could you please try these:&lt;/P&gt;&lt;P&gt;1. Create a formula  @disp_shr to display the value of the shared variable on the Main Report's group:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;shared numbervar CountFS;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Place this on &lt;STRONG&gt;Group Footer#1.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;2. Create a reset formula and place this on the Group Header:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;shared numbervar CountFS := 0;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;3. Does the @disp_shr formula show the correct value for each group the subreport runs for?&lt;/P&gt;&lt;P&gt;4. If yes, modify the @disp_shr formula to:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;shared numbervar CountFS;
shared numbervar gtot;
gtot := gtot + CountFS;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;5. Create one final formula to display the grand total and place this on the Report Footer:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;shared numbervar gtot;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;-Abhilash&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Nov 2019 22:50:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/crystal-reports-issue-with-shared-variables/qaa-p/12106944#M4523230</guid>
      <dc:creator>abhilash_kumar</dc:creator>
      <dc:date>2019-11-26T22:50:24Z</dc:date>
    </item>
    <item>
      <title>Re: Crystal Reports - Issue With Shared Variables</title>
      <link>https://community.sap.com/t5/technology-q-a/crystal-reports-issue-with-shared-variables/qaa-p/12106945#M4523231</link>
      <description>&lt;P&gt;So, I appreciate the help with this and am sorry to have wasted anyone's time. When I manually add up the subreport column that displays on the main report, it turns out the shared variable is actually correct. I guess maybe due to some of the linked parameters I have perhaps some things are not making it on the main report thus not being added thus the different number than the subreport? I'm not sure, but, the calculation is apparently correct.&lt;/P&gt;</description>
      <pubDate>Tue, 26 Nov 2019 23:32:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/crystal-reports-issue-with-shared-variables/qaa-p/12106945#M4523231</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2019-11-26T23:32:42Z</dc:date>
    </item>
    <item>
      <title>Re: Crystal Reports - Issue With Shared Variables</title>
      <link>https://community.sap.com/t5/technology-q-a/crystal-reports-issue-with-shared-variables/qaa-p/12106946#M4523232</link>
      <description>&lt;P&gt;So, I appreciate the help with this and am sorry to have wasted anyone's time. When I manually add up the subreport column that displays on the main report, it turns out the shared variable is actually correct. I guess maybe due to some of the linked parameters I have perhaps some things are not making it on the main report thus not being added thus the different number than the subreport? I'm not sure, but, the calculation is apparently correct.&lt;/P&gt;</description>
      <pubDate>Tue, 26 Nov 2019 23:33:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/crystal-reports-issue-with-shared-variables/qaa-p/12106946#M4523232</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2019-11-26T23:33:03Z</dc:date>
    </item>
  </channel>
</rss>

