Skip to Content
avatar image
Former Member

Crystal 2013 Shared Variable is not passed to first row on all pages after the first page.

I have a shared variable in a detail row that is passed to an on demand subreport. However, the shared variable is not being passed to the subreport when it appears in the first row of the second page. It is being passed when it appears on the second row of the second page. This actually is happening on every first row of every page after the 1st page. I have tried moving around the formula that creates the shared variable (putting it before the row, after the the row, even in the detail row). Nothing is working. If I cannot get this to work, I'm afraid that we will be switching to SSRS, which doesn't have these kinds of issues.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

8 Answers

  • Best Answer
    avatar image
    Former Member
    Mar 31, 2017 at 04:52 PM

    I'm re-doing the report. I do not trust Share Variables at this point.

    Add comment
    10|10000 characters needed characters exceeded

  • Mar 31, 2017 at 07:13 AM

    Try splitting the detail section into two, place variable formula in top section and subreport in lower section. Suppress top section.

    Ian

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Mar 31, 2017 at 02:01 PM

    I did that already. I also tried placing the varable in the lower section. It didn't work.

    Add comment
    10|10000 characters needed characters exceeded

  • Mar 31, 2017 at 02:43 PM

    You mentioned "OnDemand" subreport.

    Does it work if the subreport is not OnDemand?

    Add comment
    10|10000 characters needed characters exceeded

  • Mar 31, 2017 at 02:49 PM

    Do have repeat groupheader on new page checked?

    This can sometimes upset the action of variables. Try turning off

    Ian

    Add comment
    10|10000 characters needed characters exceeded

  • Mar 31, 2017 at 06:42 PM

    Hi Deanna,

    If you want to re-visit this, I'd like to have a look at the formula on the Main Report and the formula on the subreport and where on the subreport you placed the formula.

    Thanks,

    Brian

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Mar 31, 2017 at 07:28 PM

    I have changed the report. Frankly, I do not find shared variables every reliable.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    May 02, 2017 at 09:10 PM

    I now have this happening on a report that has 46 on-demand subreports so I am not looking forward to changing all variables to parameters that can be passed.

    The main report formula is:

    WhilePrintingRecords;

    numberVar CMS2_Cnct;

    shared stringVar s_CMS2_desc;

    shared numberVar s_CMS2_d;

    shared numberVar s_CMS2_n;

    shared numberVar s_CMS2_except;

    shared numberVar s_CMS2_excl;

    shared numberVar s_CMS2_score;

    If {Command.QM_ID} = 90019482 then

    ( CMS2_Cnct := {Command.SUM_QM_CNCT_NUM};

    s_CMS2_desc := {Command.RECORD_NAME};

    s_CMS2_n := {Command.QM_NUMERATOR};

    s_CMS2_d := {Command.QM_DENOMINATOR};

    s_CMS2_except := {Command.QM_EXCEPTIONS};

    s_CMS2_excl := {Command.QM_EXCLUSIONS};

    s_CMS2_score := score({Command.SCORE}) );

    The subreport formulas are basically this:

    whileprintingrecords;

    Shared NumberVar s_CMS2_d

    The main report formulas are in Detail A and the subreports are in Group Footer 4.

    I have had this problem on another report also with multiple combinations where the main formulas were in Detail A and the subs were in Detail B. I also tried with both on the same Detail line.

    It makes no sense that it would not pass data to the first line on the second page and each subsequent page. It does pass to the second line and all others on the page.

    Add comment
    10|10000 characters needed characters exceeded