Jaspersoft studio calculate variables before detail band - jasper-reports

Jaspersoft studio 6.2.
The report below, there are 3 bands: title, detail, and summary. Detail is in the middle. Look at "Activated staff" on the top on title band, it used a variable (activatedstaffcount1) as expression. The variable sum all activated staff counts in the detail. However it shows null. The bottom one is in the summary band and used the same variable but it shows correct number. The middle section is the data (detail band). I want to show aggregated result before the display data(detail band), how can I do it?

Try to set also Evaluation time in the text field which contains that variable to the "Report".
If the text field is outside of the table - try to return value into the parameter back from dataset and display that parameter at the end of report evaluation.

Related

CR | Open subreport by clicking on database field in main report

this case is a little more difficult I think.
In my main report I have material numbers displayed in a cross table.
From time to time I need to show more details for one of the material numbers. Therefore I want to double click this field and then copy the corresponding material number to the sub report (directly in the parameter field). Another fixed parameter field is the date, which has the max date "today" and the min date "today-365d".
Moreover I don´t want to make the sub-report visible in the normal report the whole time. It should just be visible if I double click a material number.
Is there any possible way to that?
Thanks in advance!
You can do this in 2 ways, with either an on-demand sub report or by utilising the drill down
Using sub reports
In your main report go to insert>Subreport. Create your sub report with the detail you wish to see, then click the tick box for "On-demand subreport". Place the sub report in the details section along with your material numbers. You'll see it appear like a hyperlink. Right click then Format Subreport>Subreport tab. You can change the Subreport caption to the material number from your data by clicking the formula button for "On-demand Subreport Caption" and entering your material number field name as the result of the formula.
Whjen you ruin the report you can click the link to see the etail in the subreport
Drill down method
Create a report with all the detail you need in the details section. Group by material number then in section expert (Report menu) use the tick box to "Hide (Drill-Down OK)" the details section. Now when you preview the report the group header will show with the material number, clicking this group header will open the details section.

how to get rid of the white space when hiding a subreport ssrs2008?

I am using SSRS-2008. I am using a subreport named SubReport1 in my main report named MainReport1.
When SubReport1 has no rows, I get white-space in place of SubReport1in MainReport1.
How can i get rid of this?
The subreport will be displayed in main report with the properties mentioned in the subreport itself. So, if reduce the row height, it will not affect the report display if there exist a value. In all other cases, you will not see a blank space over there in the main report. (The row boundaries also could set to 'None' values in main report)
Select the row properties -> under 'Layout' section, you could find the 'Height' parameter. Provide value for this parameter as 0.07938cm

Passing Value from Sub Report To MainReport on Crystal Reports

I'm currently having a problem with regards on Crystal Report Shared Variable. this is my situation.
I have a Report consist of multiple sub reports (and of course the main report). i need to expose a value in main report from Sub Report, but the problem is i need to Display it before the sub report was rendered. Please see the image below:
As you can see the image above, i need to display the value below (Sub report with RED encircle with VALUE) on the TOP (Red encircle without value).
I used Shared Variable but i think it will not work since the TOP will be first rendered (where i need to display the Value from subreport) before the Below(where i need to get the value).
Is it possible?
The section that displays the value has already been rendered by the time the other section sets the value of the shared variable.
Two options:
add a second instance of the subreport to a section that precedes the section when you want to display its value; you won't be able to suppress either the section or the subreport, so you will need to make the subreport as small as possible and change the font colors to white
use a sql-expression field to calculate the desired value and avoid the subreport complexity altogether

How to reduce space in crystal report detail section?

I have a crystal report. In that I need to reduce much more space in detail section. how to do that?
I tried suppress method.but again it showing same problem. how to solve this ?
Here is my crstal report design and output samples
Here is output sample
while taking print it is showing more space . after first report entry , it is showing more space. indicated using next report in red line.
Here are a few ways:
align the top edge of each item to the top edge of each section
make the height of each item in each section equal to the height of the shortest item in that section; if you need any field to grow, toggle its 'can grow' property to checked
set each section's height to match the height of its tallest field
delete or suppress PageHeaderSection4 and ReportFooterSection2
does the Supplier ID and associated field need to be in its own section?

JasperReports, PrintWhenExpression and RemoveLineWhenBlank → Strange Behaviour

I have a problem with JasperReports when using printWhenExpression and RemoveWhenBlank inside a subreport.
To reproduce this problem, I made a simple example using one master report and two subreport.
The first subreport, let's call it the static subreport, contains two Static Text components in the title band (Label 1 on the first line, Label 3 on the second), both have the Position Type attribute set to Float. The title band Split Type attribute is set to "Immediate".
The dynamic subreport have three Static text components (Label 1 on the 1st line, Label 2 on the second and Label 3 on the third), all of them have the Position Type set to Float. But Label 2 has PrintWhenExpression set to Boolean.FALSE and RemoveLineWhenBlank set to TRUE. So Label 2 is hidden and Label 3 is moved to Label 2's place under Label 1.
So basically the dynamic subreport and the static one have the same structure and should behave the same way when printed inside a report. But that's not the case in this little example.
In the master report I'm using a subreport component inside the detail band ( the split type of the detail band is set to Immediate ) and using a JREmptyDataSource with 90 empty rows. When pointing the subreport component to the static subreport, the pdf output generated by jasperreports is corrrect. But when using the dynamic subreport, jasperreports leaves an empty space (that is used when using the static subreport) at the end of the first page and jumps to the next page to print Label 3.
In the real case that I have a problem with, I have a subreport that contains more than 20 lines with Static Text and Text Field components, most to them with printWhenExpression set to a field or a parameter and RemoveLineWhenBlank set to TRUE. When producing the pdf output in some cases I have that specific subreport (which should occupy just  a third of a page) spanning one page and a half with a lot of space spread between the visible lines in the subreport. And I think the combination of RemoveLineWenBlank and PrintWhenExpression is what's causing the problem.
 
So what I want know is if this is a bug or just me missing something in the documentation.
Here is a link to the post I made at the JasperReports forum, it contains the templates for the master report and the two subreports, plus two pdfs generated by jasperreports and screenshots showing the layout of the subreports: link
Thanks in advance for your help.