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
Related
In my report, i have created a xxx parameter which takes values from the report data set.
xxx parameter is not being passed to stored proc which is used to show the data for the report.
Now When the report does not have any data for other parameters, i get an error saying xxx parameter is missing a value.
I tried allowing blank values in the parameter properties.
Check that parameter's - Available Values by going to report parameters properties.
It must not be specified any values. So we should set it as None
Another way is,
Just add a blank space at Specify values - in Default values inside report parameters properties.
Third way
Ido an "if exists" statement for this to go away. It worked for me because it makes it always return a value even if that value is not need by my query.
if exists (my select query)
my select query
else
select '2'
// '2' would never be used, but it made ssrs stop giving me
// the stupid error and execute
This should help.
I have a report with 2 columns, both columns measure Sales. I would like 1 column to filter on a supplier while the second column would be overall sales so that I can compare the sales of the supplier to the total sales. This report would be used on a dashboard, however I cannot figure out how to get the total sales column to ignore the prompt for the supplier. Is there any clauses I can use to ignore the dashboard prompt for this one column?
Method:
The prompt sets the variable
Report A calls on the variable to tell it what to include
Report B calls on the variable to tell it what to exclude
How-to
Setup Prompt for “INCLUDE” variable.
Notice the "Set a variable" is set to Presentation Variable:
Report A
Report Filter: Setup Report Variable to accept “Include”:
Report B
**Save a copy of the report and say “is not equal to”
To compare the “All Other except for” report
Below is a simple example on a dashboard.
With no filter set, notice that the "exclude" side is showing all results:
A user must then select an item from the prompt (setting the "Include" variable)
Once the user presses apply you notice that the left side is including the selections and the right side is including everything EXCEPT for whats on the left side:
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.
I am creating a report in SSRS 2005 and where there should be a NULL value in the table it is returning a value ("Alle" [the tables are mostly in German]). This isn't really a problem as I think I can hide the value as explained here:
How to hide certain on SQL Reporting Services 2005
However, when I add =Replace(Fields!LengthofFunding.Value,"Alle","") to the Expression box in the field I want to hide the value for it is returning a FALSE value rather than a blank.
Can anyone let me know how I can make this field return a blank value?
I think instead of replace you can use the Iif as following:
=Iif(Fields!LengthofFunding.Value = "Alle", " " , Fields!LengthofFunding.Value )
This means if its equal to "Alle" replace with blank, else keep the original value.
I am trying to set a couple of global variables in a subreport so that it pulls and stores the data I need in each.
Say I go into the formula workshop and create a new formula. Right now I have
Global numbervar name:= ;
I have a single table with multiple fields. I have one field named {table.order} and another named {table.amount}. Both of these are numbers. How do I assign to this variable the amount in the associated amount field when the order is -1? I'm really not familiar with crystal syntax at all.
After this, where would I need to drag and drop this formula in the report to pick up this data or is simply creating the formula in the formula explorer enough? If it needs to be physically dragged into the report, will anything show up or will I need to suppress it so it is not visible and if that is the case, will it still work suppressed?
Thanks for any help you can give.
Are you trying to pass the value in this variable back to the main report? If so, you'll need to make this a Shared Numbervar, not a Global Numbervar.
To answer your question; create this formula:
global numbervar name;
if {table.order} = -1 then name := {table.amount}
...and drop it into your subreport's details section. Note that any formulas, summaries, running totals, SQL expressions, etc. that you create but are not placed in the actual report won't be run. However, after placing it in the report, it will display. To prevent this, right click on the field, go to the 'Common' tab, and then check 'Suppress'. The formula will still work when suppressed.
One other thing to keep in mind is that if your subreport(s) contain more than one row of data, the variable will be overwritten for each.