Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Formula Error - Must be evaluated later Post Reply Post New Topic
Author Message
megli
Newbie
Newbie


Joined: 24 Jul 2012
Location: United States
Online Status: Offline
Posts: 3
Quote megli Replybullet Topic: Formula Error - Must be evaluated later
     Posted: 16 Oct 2013 at 5:36am
I have two versions of the same report in Crystal 11 with multiple (20) subreports which I use in two different ways. 
 
In one version, I look forward 31 days, to get a look at the data for the next month. 
 
In the second, I look forward 3 years, to get a more macro look at the data. 
 
The top level report has no selection criteria or actual data, it simply contains the headers for the subreports.
 
I have historically maintained two reports since the number of days I am looking forward is captured in the subreports.  This has led to some problems as I have to maintain all 20 subreports in both versions of the report... without getting into too much detail, they are used for scheduling work in our production facility.
 
I have recently discovered how to pass a shared variable from the top level report to the subreports and was hopeful to use that to pass the "Days to Look Forward" information to the subreports.  My thought was that this would allow me to use a Parameter Field on the top level report to pass information into the subreports.  Within the subreports I would then set up a formula field with an if (or iif) statement to set an offset for the days to look forward.  That formula field would then be part of my Selection Criteria on the date.
 
I have confirmed that the information is being passed correctly to the subreports, but when I take the next step and use that in the Selection Criteria, I get a "This formula cannot be used because it must be evaluated later" error message. 
 
When I first saw this error, I tried doing the if (or iif) statement on the top level report and pass the result to the subreport.  Again, I confirmed that the data came over accurately, but I still get the same error.
 
Is there a way to do what I am describing here?  I hope the issue is clear, but you need me to clear things up, let me know any questions.  I am not a programmer, so the simpler the solution (and the more detail provided), the better.
 
Thanks!
Mike
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 16 Oct 2013 at 6:35am
youc an just use the param created in the main report as a link to the sub reports. This will create a param value in the subreports which can be used in the select statement for each sub report.
IP IP Logged
megli
Newbie
Newbie


Joined: 24 Jul 2012
Location: United States
Online Status: Offline
Posts: 3
Quote megli Replybullet Posted: 16 Oct 2013 at 3:17pm
DBlank (and any others with suggestions),
 
Okay, I have created the parameter field in the main report, and I assume that when you say to use it as a link to the subreport you mean in the "Change Subreport Links" dialog.  When I do that, it requests a field to link it to... I created a blank formula field in the subreport to link it to, but it doesn't show up when I try to link... I put the formula field onto the subreport (so it shows as being used) and still there isn't an option for linking...
 
I also tried de-selecting the option "Select Data in subreport based on field" in the Subreport Links and don't see the top level reports parameter field when I go into the subreport and try to set up my selection statement...
 
Any further guidance?
Mike
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 17 Oct 2013 at 4:15am
When you link it you should be given the option of selecting another parameter that will be created in the sub report. Don't link it to a field in you subreport. The new param will be named with a ?sr"  or "?pm" in front of the existing name of the main report parameter like "?sr Date Range Type"
now inside your subreport you will have an new paramater available with that name which canbe used as an option in  your select statement.
IP IP Logged
megli
Newbie
Newbie


Joined: 24 Jul 2012
Location: United States
Online Status: Offline
Posts: 3
Quote megli Replybullet Posted: 09 Nov 2013 at 4:12pm
Okay, so I just deleted a note saying this didn't work... It does, but to make it work, I had to select a field on the subreport to link the parameter to, run the subreport, and then go back to the edit subreport links dialog box and uncheck the Select data based on field box...
 
random, but it worked... thank you very much!
 
Mike


Edited by megli - 09 Nov 2013 at 4:26pm
Mike
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum