Is this possible? I think i read somewhere that it isn't. Have tried doing it with a shared variable and haven't had any luck, but could be incorrect syntax.
I think the datadate in the subreport will always be the same as the datadate in the main report, since the subreport would be refreshed when the main report is, so not sure why you'd want to do this. But, make sure that the shared variable in the main report:
whileprintingrecords;
shared datevar x := datadate;
...is in a section above the subreport where you want to reference it. The formula MUST be placed on the main report canvas. In the subreport, you would then reference it by creating a formula:
Yer I was hoping that it would have the date of when the main report was refreshed, but it must be retrieving from the database when you 'request the subreport on demand', as it gives it current date.
Those are the formulae I have, i put the first one in the report header section of the main report, and it shows the datadate as expected, but when I place it in the subreport the field shows blank. I am trying to place it in the sub-report header and a group header that i'm using as a fake page header. Neither work, nor does putting it in the details section.
The comment I read before that suggested this is maybe not possible, said (I think) that you can't pass something between main and sub reports unless it gets its value after the sub-report is generated. That makes only a small amount of sense to me...
I tested this before responding, so you definitely can do it. Where is your subreport located? If it is in the report header also, then insert a report header_b section and place the subreport there. Your shared variable formula should be placed in the report header_a section.
The subreport is in the details section. So the formula is two sections higher in the report header. I'm using version 8.5 not sure if that's got anything to do with it?
And you are using "whileprintingrecords" in each formula? And you are placing the formula itself (not the special field "datadate") into the report and subreport? Maybe you'd better copy your formulas into this thread--in case it allows us to see an error, e.g., a slightly different name for the variable in each formula.
I use 8.0, so it doesn't seem likely that the version is the factor.
For some inexplicable reason, it works fine this moring - without changing anything! Lost on me, it's obviously another fabulous "feature" of crystal reports....Thanks for all your help anyway
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.