Jaspersoft Studio: Force input parameter of subreport to be entered manually - jasper-reports

In my main report I get a (small) list of string values from the data base. I then want to use this list for selecting records in a subreport, along with other input parameters:
The user shall be able to select records based on a range of begin and end date -- this is easy using an input parameter of type java.util.Date with "Is For Prompting" set to true. Another criteria shall be one or more items from a list showing values from a data base field. I could define the list in the report template, but then I'd have hard-coded strings (filled from the data base, but at definition time only).
Now the dilemma is: If I define the input parameters in the main report, I cannot get the values for the list beforehand; if I define them in the subreport, I get no prompt at all, so there's no way to set any of them.
So the report requires values for start and end date, and a list of string values to select from (multiple itmes can be selected). This list shall be built from values from the data base. In the subreport all these values shall be joined into a filter for the records. A user shall be able to define the dates and select items from the list manually before executing the report.
Is there a way to achieve this?

After some more hours of trial & error, and some more research, of course, I found that the keyword is "Query-based Input Controls". This documentation describes their creation on the JasperReports Server. Such input controls can be edited in Jaspersoft Studio as well, however, they actually work on the server only. Anyway, this is the solution to my problem.

Related

Adding Signature Blobs to Crystal Report Form

New to Crystal Reports (2013) and learning by doing. I have a client agreement form that has five signature blob fields stored in a column in a separate table. I need to populate each of those five signatures into the correct spot on the form. I tried doing this with formula fields and I'm not having any luck. The field doesn't even show as an option under the SQL Expressions Fields options. If I try it as a regular formula field IF statement I get an error message that says blobs aren't allowed in formulas. If I just add the field to the report, it pulls in only the final signature as there's no conditional statements telling it which signature to grab. How do I go about creating a formula/field/object for each of the five signatures so I can place them on the form? In SQL I'd do a series of SELECT signature_blob WHERE signature_number = X but that doesn't seem to be an option that I'm finding.
Edit: so I think I've managed to do it like this by adding a new database command for each field, but is there a better way?
Create a database view that returns the 5 signatures as 5 columns and a single row + one column for the Agreement ID.
Add that View to the report and join (on Agreement ID).
You can do the same thing directly in the report without a View by adding the Signature table 5 times with different aliases and restrict each alias to a single signature. This would be the same logic as the database view but would be a bit slower.

Crystal Report create separate report pages based on field value change

Looking for some advice related to data grouping and printing in Crystal Reports.
I'm working with an order confirmation form. Ideally I would create separate report pages based on a specific field value change for the 'warehouse' field. So, if any given line on an order comes from warehouse A, it prints together. Then we'd get a page break, and we'd see the form repeat for any lines coming from warehouse B.
I've inserted a new group for "warehouse" and configured the group as 'New Page Before.' But when I attempt to print I'm getting an error related to "There must be a group that matches this field". So there must be some pre-existing grouping that I'm not considering. I'm hopeful I can figure this out.
I am interested to get thoughts on overall design, and if the grouping approach I am trying to take is even the correct one.
Somewhere in your report you probably have a formula such as:
Sum({some_value}, {some_field})
where the {some_field} used to be -- but is no longer -- grouped upon.
Fix that expression to set the desired aggregation level (the 2nd argument) to a field you are actually grouping on.

Displaying multiple records in Crystal report as comma separated value

I have a view that I am using to display some information in Crystal report file. In some cases, view is supposed to return more than 1 record.
By default, in these cases, Crystal report take the last record and display that one. So, if I have two records with id A and B, I will see only the details of B.
I want to have an option where both A and B are displayed separated by comma.
E.g. if EmployeeDepartment in Employee table has two records (CIS, FINANCE) for employee A, then I want to see #EmployeeDepartment return "CIS, FINANCE" instead of just "FINANCE".
I have been trying to find a way to do this. Till now, I have gotten this far:
Base formula
Shared Stringvar store;
store:=store+{TBL_MR_Header.MRHD_Customer_Ref_No}+ ", "
Display formula
Shared Stringvar store;
store
When I run the report, base formula returns "B," instead of "A,B". Display formula on the other hand displays nothing.
I am unsure what I am missing here.
Edit:
I have created a query that returns the two value comma separated, in both records. So, both records display "CIS, FINANCE" instead of "CIS" and "FINANCE" respectively. Now, I have simple problem, how do I put this query in crystal report file? Only option I can find is to use that datasource expert tool but that does not allow updating query.
Edit:
I actually decided to go different route there. I tried putting the base formula in header and display formula in detail section, but that didn't work either. Turns out, one of my colleague tried a trick to solve similar problem. He used the C# code to call a T-SQL query, got the value in CSV format, and passed it as a parameter. It requires an extra trip to database, but it made it easier.

SSRS Aggreation on Calculated Field

I am trying to perform an aggregation on a calculated Field in SSRS and am getting the following error:
[rsAggregateReportItemInBody] The Value expression for the textrun 'Textbox43.Paragraphs[0].TextRuns[0]' uses an aggregate function on a report item. Aggregate functions can be used only on report items contained in page headers and footers
This is the formula I tried to use:
=Sum(ReportItems!PlanPurchPrice.Value, "Select_UCPUtilization")
In this Case PlanPurcPrice is also an Expression:
=First(Fields!PawPlanPurchPrice.Value, "Select_UCPUtilization")
Any suggestions on this would be greatly appreciated.
SSRS 2008 does not support the functionality you are looking for unless the report item is located in the header or footer (as is stated in the error message). I would, instead, propose two alternate solutions:
First Option
Place the calculation in your query (if possible) at which point you can then reference the field and the aggregate will work as desired.
Second Option
You essentially want to create the aggregate you're looking to return elsewhere in the report where it is directly connected to the Select_UCPUtilization scope, then reference the aggregated value elsewhere. Follow these steps:
Within the same scope as report item PlanPurchPrice, calculate a sum of the PlanPurchPrice. Name the textbox containing the aggregate something meaningful (e.g., Sum_PlanPurchPrice).
Reference that textbox directly wherever you were trying to use the ReportItems sum before (i.e., =ReportItems!Sum_PlanPurchPrice.Value)
Hide the workaround. Place the aggregate you created in an additional column or row attached to the Select_UCPUtilization scope. Turn the text white, turn off growth and shrinkage, and make the row very tiny (a pixel or two high).
Using the second option, the report item does exist (and is visible, which is important) on the report and contains the sum you are looking to return elsewhere.
Hope this helps. if this doesn't make sense, please reply via comment and I'll help you to the best of my ability.

Can I assign a value for one parameter

I am using crystal reports 2008. I want to generate a report for which i will get one value from one subreport and i want to pass this value as a parameter so that i can include this value in the sql command.
For eg.
From my subreport i will get customerkey and i want to pass this value in the sql as
{?customerkey}
Sql is 'select card_number from customers where customerkey={?customerkey}'
For this i created parameter in the command and added like this.
But what my problem is this customerkey is getting from subreport(using shared variable).If i get a value customer_key from subreport how will i assign this value to {?customerkey}. I tried like assighning this value but i dont want to popup {?customerkey}this value as a parameter.
Can anyone help? Please
So you want the data shown in the main report to be based on a parameter passed to it from a subreport? I don't think this is possible - the Report Processing Model (described here) states that SubReports are in 'Pass 2', while data retrieval is in 'Pass 1'. This means that the parameter prompt will always appear first.
You might instead be able to have the main report contain TWO subreports, the first of which is used to retrieve the parameter and the second uses it. That can get very messy, especially when dealing with page headers and footers.