I am working on Ireport 4.0.1 version.
My requirement is to pass parameter dynamically to the report that is my report consists two parameters like product_category and product_id. if i select value for product_category parameter and no value for product_id then the report should give data that filters on product_category else if i give both then filter upon both values. How can i acheive through Ireports.Please anyone could help me .
Thanks in Advance
Swathi.
You can use optional where clause condition, to make parameters optional try this :-
WHERE product_id= $P{product_id} or $P{product_id} is null
AND product_category= $P{product_category} or $P{product_category} is null
If the parameter is Collection type then you do not need this condition.
For more help you can refer this Link
Related
I created a parameter [GroupID] that is used to query several datasets in my SSRS report. It is using the field [GroupID] from my GroupList_Rolling12 dataset. An example of [GroupID] is 77610N. When 77610N is selected, all of my datasets are correctly 'filtering' for this [GroupID].
I now need to create a text box that returns the [GroupName] of [GroupID]. In other words, when 77610N is selected from my GroupID parameter, I want the [GroupName] that is associated with the selected GroupID parameter to display.
I'm still very new to SSRS and cannot figure this out. I tried creating the expression =First(Fields!GroupName.Value, "GroupList_Rolling12") but that did not work since it simply returns the first value from the query.
I also tried =First(Parameters!GroupID.Value(0)) but this also did not work
I also tried this expression =Lookup(Fields!GroupID.Value, Fields!GroupID.Value, Fields!GroupName.Value, "GroupList_Rolling12")
)
Can you please help?
You can reference the parameter label directly like this
=Parameters!GroupID.Label
There is no need to put the index on the end (=Parameters!GroupID.Label(0)) unless your parameter is multi-value, in which case it would select the first selected entry.
I want to get all rows that have one unique column. The problem with my code is that it works only when I select just that one column, but in the end I need to have multiple columns.
$values= Model::select('id','value_first','gender_first','value_second','gender_second')->groupBy('value_first')->get();
Here is Solution of Your Problem
$values= Model::select('id','value_first','gender_first','value_second','gender_second')->distinct('value_first')->get();
As per Laravel Documentation you can use distinct method for the same
The distinct method allows you to force the query to return distinct
results for e.g
$values= Model::select('id','value_first','gender_first','value_second','gender_second')->distinct('value_first')->get();
Reference: Laravel-> Database: Query Builder -> Selects
I have a parameter form with a value for the fiscal year and equipment ID. I want to populate the equipment ID list of values based on the fiscal year that is selected.
My query for the equipment ID list of values would be
SELECT EQPID,NAME FROM EQPLIST WHERE FY = :FY.
When I tried to add this query to the list of values of the equipment ID parameter I get
REP-0781: Bind variables are not allowed in the Select statement.
Is there a way to dynamically generate the list of values select statement in a reports trigger?
Cascading LoV, eh?
Which Reports version do you use? If it is 6i (client-server), I believe that your only resort is to create a parameter form using Oracle Forms, and then pass those parameters to a report.
If you're on a higher version (web-based), have a look at Metalink note 185951.1 ("How to create a parameter LOV based on another parameter value?") which includes sample code. Or, as above, create your own parameter form in Forms (that option works in any version).
I'm working on a module to pull data from Oracle into a PowerShell data table, so I can automate some analysis and perform various actions based on the results. Everything seems to be working, and I'm casting columns into specific types based on the column type in Oracle. The problem I'm having has to do with null dates. I can't seem to find a good way to capture that a date column in Oracle has a null value.
Is there any way to cast a [datetime] as null or empty?
Here's an easy function to test if a value from a database column is NULL:
function test-sqlnull{
Param($value)
return [System.DBNull]::Value.Equals($value)
}
If you need to store a null in a datetime field, just set it to [DBNull]::Value.
I think I have a solution that will work. Rather than attempting to set the field as null or empty, I'm not setting it at all. Now the empty value can be identified by checking if the file type is [System.DBNull].
$data | ? {$_.myDate.GetType() -eq [System.DBNull]}
How would I sort a DataTable using Linq? I've tried the following but received the error:
InvalidCastException was unahndled by user code. Specified cast is not allowed.
var query = from c in allFiles.AsEnumerable() orderby c.Field<DateTime>(1)
descending select c;
That would suggest that for at least some row, field 1 isn't a DateTime. If it may be null, you might want to try DateTime? instead. Or check that it really is that field in the first place... maybe use a name instead of a number?
The table was dynamically generated and had no actual specified column dataType. When I created the column and specified the dataType the issue was resolved.
I'm not sure why I didn't realize the dataType wasn't defined until after I posted this question.