Input controls on JasperServer - uncheck visible, get errors - ireport

I have a report that I created in iReport professional 4.5.1 and have deployed to JasperServer. I have a parameter in my report that is used to specify a sorting column:
Name: profit_loss_sort
Parameter Class: java.lang.String
Use as a prompt: Yes
Default Value Expression: "FAC_ID"
Then I have another parameter that takes $P{profit_loss_sort} and uses it to create an ORDER BY clause for my query:
Name: profit_loss_sort_function
Parameter Class: java.lang.string
Use as a prompt: No
Default Value Expression: "ORDER BY "+$P{profit_loss_sort}+" ASC"
When $P{profit_loss_sort} is set to visible, this works fine in iReport and on JasperServer. I have set a hyperlink on each column label and when you click on those, the report sorts on each column.
When I uncheck the visible box for $P{profit_loss_sort} attempt to run the report for the first time I get an Oracle error that I'm missing an expression (ORA-00936: missing expression). I don't understand that because the ORDER BY clause in my query is:
$P!{profit_loss_sort_function}
so JasperServer should take the defaults of those two parameters and come up with an ORDER BY clause. In fact, when I run the report from iReport using the "Run JasperServer Report" option it acts appropriately and fills in the default ORDER BY clause. $P{profit_loss_sort} is mandatory and on the JasperServer side I have unchecked "always prompt" for my input controls.
I don't want $P{profit_loss_sort} to be a visible input control, but I still want it to use the default value the first time the report is run. Any thoughts?

I figured it out - I have a main report that is passing parameters to a subreport. I had set a default value for parameter $P{profit_loss_sort} in the subreport, but not in the main report.
I set a default value for it in the main report, and now when I uncheck that "visible" box, the JasperServer report hides that input control and I can sort using my hyperlinks.

Related

TelerikReport send null as parameter to StoredProcedure

I want to use Telerik report in project, and want to use a stored-Procedure as data source. So, I should make a report in Telerik Report Designer in first step (my problem), and then use it in my Asp.net project.
I exactly used the (wizard) approach to make data source and parameters, mentioned in Telerik documentations, but there is a problem:
The report passes only the default parameter defined on design time, and when I change the parameter value in preview mode, it doesn't be passed to SP. If I set no default value for my parameters, the SP would be call by null values, always. It seems there is no mapping between input textboxes and the parameters are be sent to SP.
Is there anybody had the same experience, that can help me?
UPDATE:
What I did:
create new blank report in Telerik Report Designer R1 2017
From Data tab, Select SQL Data Source,select the proper SP from an Existing Data connection, leave the parameters default value empty and then execute...and finish.
In Report Explorer window, right click on Parameters, and add new parameter with the name and data type of stored procedure parameter. Change it's visibility to true, without any value.
From Home tab, select the preview and checked the SQL Profiler for db calls tracking. The Sp is called by null values at first time, but even when I change the parameter value in preview mode, again the SP is called by null parameter values.
In design time, after selecting your SP as data source, you will see the Configure Data Source Parameters.
In this window, you see your SP's parameters with value types. In Value column, click each row and select <New Report Parameter> and then select the parameter. The value will be change to proper value, for example:
= <Parameters.CustomerNumber.Value>
And this will work correctly. The problem was the 3th. step in question above. (adding the parameters, manually)

OBIEE 12C: dashboard prompt auto fill when selection is sql result

I wanted to created a dashboard prompt which would automatically fill in with the first available value. This is possible when the selection choices are e.g. all column values.
What I need is to select my values via sql result but still want to fill in the first available value, but that option is blanked out when choosing sql results.
Is there a way to achieve this, maybe via adapting the xml?
Thanks!
What you have highlighted is ONLY ever active when you have interdependent prompts with constraints. I.e. "Limit values by" set to TRUE

Cognos Reporting - Generate report only if condition is met

Is it possible to prevent a cognos report from being generated if some value say flag is set to false and only generate when flag is set to true. This value needs to be accessed within report studio.
Create a query which pulls this value
Create a boolean variable against this value
Drag a conditional block from the toolbox in the Page area of the report
Set the "Block Variable" property to the Variable and check the values for it to be rendered
Create the report items (lists, crosstabs, charts) inside the conditional block
Optionally repeat for header/footer if you want to handle them separately

Crystal Reports 2008 unable to link parameters to subreport

In Crystal Reports 2008 I have a main report with arg_beg_date and arg_end_date parameters. I want to pass these to a subreport, but have not been able to. The subreport has a Command with a SQL query in it - SELECT * FROM TXFR to keep it simple. I created two parameters in the subreport named beg_date and end_date, then adding WHERE TXFR_DATE BETWEEN {?BEG_DATE} AND {?END_DATE} to the query. I tried to Change Subreport Links, find arg_beg_date in the Available Fields, and clicked ">" to move it to the Field(s) to link to box.
At that point I only see ?Pm-?arg_beg_date and "Parameter Fields" as choices in the "Subreport parameter field to use" box. I cannot link arg_beg_date from the main report to the beg_date parameter I created in the subreport.
I saw in another question where someone suggested checking the box for "Select date for subreport based on field" and selecting "report fields", but I am unable to do that. It just highlights and selects a field below that in the box.
Any ideas?
I've recently built the same report where the Subreport is a command line. I haven't written up a procedure yet but this is how the parameter should look like if you are passing a parameter from the main report to the sub report.
In your subreport SQL, the parameter must be this
WHERE TXFR_DATE BETWEEN {?Pm-?arg_beg_date} AND {?Pm-?arg_end_date}
Then in your parameter list, create
Pm-?arg_beg_date
Pm-?arg_end_date
In your main report, Change Subreport links...
Add the ?arg_beg_date parameter
Make sure the "Select data in subreport based on field" is unchecked
Do the same for ?arg_end_date parameter
In case you want to pass a field instead of a parameter and you are using a command in your main report, same steps as above but looks like this.
Subreport SQL
{?Pm-Command.FieldName}
Parameter List
Pm-Command.FieldName
I figured out what I was doing wrong. The parameters were not showing up in the list to be linked to, because the types did not match. The parameter type in my main report is DateTime, and the type in my subreport was Date. They have to match exactly.
Thanks for your help.

How to get Custom BIRT reports in SilkCentral Test Manager to pull the currently selected project?

We are using Eclipse (Galileo) to create some custom BIRT reports (version 2.5) for SilkCentral Test Manager (version 11). When creating the report in SCTM, we have to specify the SQL query to be used for the report. We also have to specify the SQL query when designing the BIRT report in Eclipse.
I know that in the SCTM SQL statement we could specify parameters to be pulled based on the current settings, such as the currently selected project:
WHERE TPN.PROJECTID_FK = ${$PROJECTID}
I thought this would carry over to the BIRT report that is associated with the SCTM report, but this is not the case. I created a new report in SCTM and specified the following query (which contains no information that will be displayed in the BIRT report):
SELECT proj."ProjectName", proj."ProjectID_pk"
FROM "Silk"."SCC_Projects" AS proj
I then went to the report tab and associated a custom report and the report displayed correctly, proving that it is using the Data Source/Data Sets from BIRT and not the SQL provided in SCTM.
The problem I'm facing is that I want the custom report to display the currently selected project, but I'm not able to specify it properly in Eclipse. I need this because I want to only have one report template to be used for multiple projects, instead of having to upload a custom report for every single project.
A Hardcoded value for the project definitely does not work:
WHERE TPN.PROJECTID_FK = 34
I tried setting it as a parameter (Name=projectID, DataType=Integer, DisplayType=Text Box, DefaultValue = 34).
WHERE TPN.PROJECTID_FK = ?
When this runs, the report pulls the Default Value, and not the currently selected project.
I tried setting it as a Dynamic Parameter (Name=projectID, DataType=Integer, DisplayType=ListBox, DataSet=ProjectID, SelectValueColumn=ProjectID_pk, SelectDisplayText=ProjectName, DefaultValue=36)
This also pulls the Default Value when the report runs.
Default value is a required field, so I don't know what to do to get this to work properly.
Any suggestions/solutions?
Here is the solution that I came up with using and example from BirtReports.doc from the Borland site:
In SCTM, I edited the SQL query from
WHERE TPN.PROJECTID_FK = ${$PROJECTID}
to
WHERE TPN.PROJECTID_FK = ${currentProject|34|ProjectId}
This creates a parameter named currentProject which passes the value 34 to the BIRT report under the parameter name rp_currentProject.
I then edited the BIRT report's projectID parameter to have the following values: Name=rp_currentProject, DataType=Integer, DisplayType=TextBox, DefaultValue = Empty/Null.
In the DataSet for the report, I edited the ? parameter to be:
Name=param_1, DataType=Integer, Direction=Input, DefaultValue=GreyedOut/Disabled, LinkedToReportParameter=rp_currentProject.
So, I upload the same report template to multiple projects and under the Report > Parameters Tab in SCTM I change the value of the currentProject parameter to the correct project ID. This ID is passed to the Report and the correct information is displayed.
BTW, I also tried this format but I was getting conflicting type errors:
WHERE TPN.PROJECTID_FK = ${currentProject|${$PROJECTID}|ProjectId}
I also tried using DECLARE/SET in the SQL to set the passed value to a variable, but I was getting an error stating that the SQL statement is invalid because it is no longer read-only.
Hope this helps anyone that has this same problem!

Resources