This formula cannot be used because it must be evaluated later

Options

I am building a report which will have a main report and several subreports. The main report will not have much data on it and the subreports will not be linked. The problem I am having is that the one thing the subreports have in common is that I want them all to cover a specific date range. What I did was create two parameters

Tagged:

Comments

  • Marie Stark
    Marie Stark ✭✭✭✭✭
    Ancient Membership Facilitator 3 Name Dropper Photogenic
    Shaun Grace:

    I am building a report which will have a main report and several subreports. The main report will not have much data on it and the subreports will not be linked. The problem I am having is that the one thing the subreports have in common is that I want them all to cover a specific date range. What I did was create two parameters

    If the subreports are not linked, youcould try putting them in the report footer.

  • Shaun Grace:

    I am building a report which will have a main report and several subreports. The main report will not have much data on it and the subreports will not be linked. The problem I am having is that the one thing the subreports have in common is that I want them all to cover a specific date range. What I did was create two parameters

    This might sound confusing and it's kind of difficult to type but LINK the subreports on the parameters (Date From & Date To).  You can pass them from the main report into each subreport and then use new subreport parameters in each subreport to calculate what you want.  You can use any date field in the subreport to temporarily link the parameter from the main report; then just edit your select records expert to remove that temporary link.  That new parameter in the subreport will then show up as a regular parameter.
  • Patrick Manning:
    This might sound confusing and it's kind of difficult to type but LINK the subreports on the parameters (Date From & Date To).  You can pass them from the main report into each subreport and then use new subreport parameters in each subreport to calculate what you want.  You can use any date field in the subreport to temporarily link the parameter from the main report; then just edit your select records expert to remove that temporary link.  That new parameter in the subreport will then show up as a regular parameter.

    Hi Marie .. that's where I have been putting them.

     Patrick, I tried the linking and get the same error. This is the linking formula (I had to add the AND).

    {@SubDateFrom} = {?Pm-@mainDateFrom} AND

    {@SubDateTo} = {?Pm-@mainDateTo}

  • Shaun Grace:

    Hi Marie .. that's where I have been putting them.

     Patrick, I tried the linking and get the same error. This is the linking formula (I had to add the AND).

    {@SubDateFrom} = {?Pm-@mainDateFrom} AND

    {@SubDateTo} = {?Pm-@mainDateTo}

    Just to clarify, I have been able to pass the parameters to the sub report. I just created a sub report without any data and it displayed the correct parameters. It is when I try to use it to make a selection that I get the error.
  • Shaun Grace:
    Just to clarify, I have been able to pass the parameters to the sub report. I just created a sub report without any data and it displayed the correct parameters. It is when I try to use it to make a selection that I get the error.

    What are you trying to do with those dates?  If you are using them to pull in gifts within a parameter-driven date range, then you can do it in one of two ways (probably more):

    In the select records expert, the formula would read {Gift.Date} IN {?Pm-@mainDateFrom} TO {?Pm-@mainDateTo}

    In a formula (not a variable because they are processing after the subreport):  IF {Gift.Date} IN {?Pm-@mainDateFrom} TO {?Pm-@mainDateTo} THEN {Gift.Amount}

    If you need to use a shared variable then you cannot use a parameter.  But you can create a contstant formula by using

    BeforeReadingRecords;

    Shared DateVar DTFROM:=Date (2012,07,01)

  • Patrick Manning:

    What are you trying to do with those dates?  If you are using them to pull in gifts within a parameter-driven date range, then you can do it in one of two ways (probably more):

    In the select records expert, the formula would read {Gift.Date} IN {?Pm-@mainDateFrom} TO {?Pm-@mainDateTo}

    In a formula (not a variable because they are processing after the subreport):  IF {Gift.Date} IN {?Pm-@mainDateFrom} TO {?Pm-@mainDateTo} THEN {Gift.Amount}

    If you need to use a shared variable then you cannot use a parameter.  But you can create a contstant formula by using

    BeforeReadingRecords;

    Shared DateVar DTFROM:=Date (2012,07,01)

    Patrick,

    Thanks for your help, it pointed me in the right direction. What I did in the end was the following:

    • Deleted the shared variables
    • Duplicated the parameters in the subreport that are in the main report
    • Added the subreport to the main report with the following linking
      • Chose the parameters DateFrom and DateTo
      • Unchecked the "Select Data in subreport based on field"
      • In the lower left box chose the matching paramenter, not the Pm one that CR creates
    • Then edited the selection criteria to lnclude the parameters.

     And it worked!

     Shaun

Categories