starlaptop Posted July 14, 2011 Share Posted July 14, 2011 I'm trying to make a subreport, for example i have a field there is three name (black, red and blue), i need to count in my report how many balck, how many red and how many blue i have. Many Thanks. Link to comment Share on other sites More sharing options...
rromine Posted July 14, 2011 Share Posted July 14, 2011 Since someone helped me out with something hard, perhaps I could help you out with something easier. Please be more specific about the details if I don't answer this one quite right.Step 1. Make the subreport, dont add anything more to the subreport (eg. totals, averages, other calculations) other than the data, see this link for an example. https://learn.usf.edu/bbcswebdav/xid-3659976_1 Step 2Set up your $V{variablename} Text Field on the main report see link and make sure expression class is integer.https://learn.usf.edu/bbcswebdav/xid-3659977_1Step 3Create the variable on the main report, for the variable expression, you have to add the function as well. see link, this function is going to direct the variable as to where to get the data.https://learn.usf.edu/bbcswebdav/xid-3659978_1Step 4Create the function $whatevernamehelpsyouremember, and be sure to add the paramater. I am pulling from an XML file, you might just need to pull it from the subreport, which I dont know your directory. For me its, /MercuryGate/Shipment/PriceSheets/PriceSheet/Charges/Charge/Weight see the link.https://learn.usf.edu/bbcswebdav/xid-3659979_1Step 5if you are using xPath you must use a / on this screen, see link. This is a fancy wizard (not lol) to help you add the function. https://learn.usf.edu/bbcswebdav/xid-3659980_1Best of luck to you, my example shows me not pulling count from the subreport, but from the sources of both the main report and subreport. Link to comment Share on other sites More sharing options...
despec Posted July 14, 2011 Share Posted July 14, 2011 I'm not a huge fan of the subreport function in Ireport, so I always try to find ways to avoid it :-). Try working this in your query, if possible, by using SUM OVER capabilities (Oracle) or whatever is equivalent in your SQL code. David Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now