I have six parameters in Report Builder. They are the following:
ProjectName
ConstructionYear
Engineer
Contractor
EPANumber
ID
#ProjectName, #ConstructionYear, and #EPANumber do not have any null values in the dataset while the rest do have null values for some records.
For the report I need to be able to pull records using any of the above combinations. Including only using one parameter, two parameters, three parameters, etc.
For example using #ProjectName and #EPANumber to pull results or using #ProjectName, #EPANumer, and #ID to pull results. Another example would be using #ConstructionYear and #Engineer or using just #Contractor.
What does my query need to look like to be able to support all of the possible combinations? Do the parameters in Report Builder need to be set up in a certain way?
Related
I am working with Talend Open Studio for Data Integration.
I want to create a simple job which shows all customers from database with specific city.
My job structure looks like this:
DbConnection -- onComponentOk -- DbInput -- row1-- tJavaRow -- row2 -- tLogRow
I have created a context parameter that contains specific values which are the city ids. I want to set the city manually after the job starts, and then pass it to my query on the WHERE clause. Is it possible to do this scenario with Talend? How should my tJavaRow code should look like?
If you want to manually input something in a running job, you can use a tMsgBox. In Component, set buttons -> Question, the rest of the settings depends on you.
You will be able to input a value. That value is retrievable from the variable RESULT of the component.
Example with tMsgBox_1
(String)globalMap.get("tMsgBox_1_RESULT")
In a SSRS report, is it possible to return a collection of values when a single value parameter is chosen?
For example, I want to have a parameter Team, with options: "Cardinals, Orioles, Blue Jays".
When a team is selected, I want to return the members of the selected team, so I can do something like
Select Runs
From Baseball.Data
WHERE Player IN (#Team)
Is this possible in Reporting Services or is there a better technique?
Create another parameter #Players and set it as multivalued parameter and internal. Use this expression to populate the parameter.
=Switch(
Parameters!Team.Value="Cardinals",split("CardinaPlayer1,CardinalPlayer2,CardinalPlayer3",","),
Parameters!Team.Value="Orioles",split("OriolesPlayer1,OriolesPlayer2,OriolesPlayer3",","),
Parameters!Team.Value="Blue Jays",split("BlueJaysPlayer1,BlueJaysPlayer2,BlueJaysPlayer3",",")
)
I am supposing #Team is not a multivalue parameter. Replace
CardinalPlayerX, OriolesPlayerX, etc. by the actual name of players.
Now in the query just use the #Players parameter:
Select Runs
From Baseball.Data
WHERE Player IN (#Players)
Let me know if this helps.
Report Objective: Performance analysis of players by statistics comparison
Desired Report Layout
Please refer to the layout and read on. The player names need to be added from a list which could be anything like entry text box, multicheck box, dropdown etc. If I select Jake Tyler in this list, the report should refresh and show me the statistics from him. Then when I select Adam Smith, he should show up as the next entry below Jake with his respective stats.
I know how to pass individual players as parameters in the query using Pentaho parameters and tagging them in the condition using SQL as:
'where PlayerName = ${playername}'
But I need to know how to pass multiple player names in a similar fashion to generate this report using multivalue String parameters.
Can you please please guide me on how to do this? I have heard things like x-actions which could work but I don't know how to use that. I am sure this will help a lot of people who are trying to achieve something similar which might seem complex to them.
You can simply use where PlayerName IN (${playername}).
The list should be correctly passed from the parameter to query.
and the parameter also should get data correctly.
Eg:
select 'Jake Taylor' as pn
union
select 'Adam Smith' as pn
union
select 'Chris Lawson' as pn
or
select distinct column_name from table_name
this can be sent to parameter (in Add parameter window) and your main query can be prepared as I explained above using IN
NB: You can use only Display types like: Multi value list, Multi selection box etc. Not drop downs which pass only single value.
I have Created a Student Information Report using Jasper report (SQL database). I need to filter the report using different parameters. e.g
Branch Wise
Gender Wise
Class Wise
Section Wise and some more
I'm using Java Swing as a front end application.
My question is for each filter i have to write separate query?? or is there a way in jasper to manage different filter for example.
You can manage your query based on the parameter you got using a different expression which is $P!{}.
Follow below steps to achieve your needs,
Create a parameter, say $P{BranchWise}.
In the expression of that parameter, write something like
$P{Branch} != null ? "and branch = '"+$P{Branch}+"'" : ""
Likewise create parameter for different filters.
Now use these parameters in your query as below
select * from table1 where 1=1 $P!{BranchWise} $P!{GenderWise} $P!{ClassWise} ....
Hope this should solve your problem.
I am writing a report where i would like the end user to be able to search by multiple terms (ie. UK, CZ)
but my code it does not fetch any results
like #variable('2. COUNTRY (UK, CZ, AT or use % for all)')
It works when just using just one term (ie. UK) but not when the user tries to search for more than one value.
I have tried using different statements before the variable but still get no results.
Is a search like this possible?
I'm writing this for Business Objects 5
Thanks
Matt
You're trying to perform a wildcard search (by using the LIKE keyword) in combination with a prompt (I take it it's a multi-value prompt).
Lets go through a few possible scenarios:
Wildcard
Example: the user enters % in the prompt.
SQL translation: Country LIKE '%'
Result: the query returns all records due to the wildcard
Single-value
Example: the user enters UK in the prompt.
SQL translation: Country LIKE 'UK'
Result: the query returns all records with the Country column matching the value UK
Multiple values
Example: the user selects UK and AT in the prompt.
SQL translation: Country LIKE 'UK,AT'
Result: the query returns no records because there is no record that contains the value UK,AT (literally) for the Country column.
What you're trying to do, as far as I can determine, is to allow the user to select multiple values or skip the selection altogether and return all values (for which you used the combination of the LIKE keyword and % wildcard).
However, with multiple values, you need to use the IN keyword instead. In current versions of BusinessObjects (you're using a very old version), it's possible to make prompts optional.
As you don't have this feature, the only alternative is to create a universe condition in which you build a CASE around your #prompt function, to determine if the user entered a % or selected multiple values and then construct your WHERE clause accordingly.
Have a look at this article for an example how to build such a condition.