I am trying to pass a total from a sub report back to the main report to use it in the selection formula for the main report. Is it possible to do something like this?
Not in the record selection formula of the main, the subreport fires AFTER the main report has performed it's select.
You might use it to suppress rows back in the main report if you fire the sub in the report header.
Anyway, what you seek is a shared variable to pass values between Main and Subreports, as in a formula containing:
shared numbervar ShrAmount := {subtable.value}
Then after the sub fires you can use this:
shared numbervar ShrAmount
in the main report to obtain it's value.
I think that your subreport might be better served as the main report, and link the main to the subreport based on a field, or use shared variables to suppress rows.
Thanks, I have spent too much time staring at reports today. When I wrote it, I was saying to myself, that won't work, but I CAN use it to do group selection can't I? That would be perfect.
Thanks for your help and for being so quick today!
Master Table contains records on incidents that have happened, each incident has one record
Child Table contains records that contain activity relating to the incidents, each incident will have from 0 to an unlimited number of activity records in this table
Relationship is, of course 1 to many from master to child
Join is left outer since activity records may or may not be present
In the master table, I need to select records based one specific activity which has occured, by date, typically the prior day
However, I only want incident records where a certain activity has NEVER occured which means that I have to go back and check ALL of the child records even the ones that occured before the date range for the container report. I am doing this in a sub-report and have it calculating if the record is present just fine, I just need to pass that answer from the sub-report back to the container report and then use it to eliminate those records that should not be there.
I know that this may be somewhat confusing, and I appreciate your help, please ask if you have questions.
In case you don't quite have it yet, this is how I'd approach it. Let's assume that you want to select only incidents with activity A on a certain date, but only if the incident has no activity B on any date.
1-Create a date parameter {?date}
2-Record select: {activity.type} in ["A","B"] and
{activity.date} <= {?date}
3-Group on {Incident.ID}
3-Create a formula {@inAnotinB}:
if {activity.type} = "A" and
{activity.date} = {?Date} then 1000 else
if {activity.type} = "B" then 1 else 0
You could substitute (currentdate -1) for {?Date} if you always want yesterday's data.
4-Add the following as a group select statement:
remainder(sum({@inAnotinB},{incident.ID}),1000) = 0 and
sum({@inAnotinB},{incident.ID}) > 0
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.