Is it possible to generate multiple charts based on changing parameter in select list of query using pipelined table? There are four parameters (ID, account number, date from, date to).
Sql query looks like this:
select * from table(days_of_being_late_pkg.f_days_late_calendar(
i_cli_id => (Select id from clients where id_num = :CHOICE_ID)
,i_acc_num => **:ACC_NUM**
,i_date_from => :CALENDAR_FROM
,i_date_to => :CALENDAR_TO
));
The task is to create a line chart based on above parameters and it works if I select the acc_num from select list, but the other part of the task is to generate multiple charts when the acc_num is not selected, taking as many acc_num parameters as there are for particular i_cli_id.
The chart shows how many days client is being late.
I hope it was clear enough.
Thank you in advance,
Josko
Related
I am relatively new to SSRS but have been working with SQL for years. I have been tasked with creating a report that reflects shipped items based on their status. For example, I have x number of items with varying statuses including "IN_TRANSIT", "RECEIVING", "SHIPPED", "WORKING", and "CLOSED". The requestor is asking if I can provide the following options in a report drop down:
"IN_PROCESS" Status filter including all statuses except "CLOSED".
"CLOSED".
Essentially, they want to be able to view all non closed statuses, closed, statuses, or all. Right now, I have it set so you can individually select all statuses, essentially getting them the data they want, just not with the "right" parameters.
My question is, does SSRS provide a way to essentially 'group' the non-closed statuses into one inside the report so that when they select "IN_PROCESS" it sends those non-closed statuses to the SQL query I have built in? The problem with using SQL for this is that the dataset I created to generate the dropdown options provides "CLOSED" and "IN_PROCESS" as it's output options, but when they select "IN_PROCESS" (sending that value to the filter in the report), since it's not an actual status, nothing comes back.
If more information or clarification is required, please let me know.
Thanks ahead of time!
You can create a new column in your SQL query and use a CASE statement to give the value of IN_PROCESS or CLOSED for the applicable status. Then you will just need to the filtering condition to match the SSRS parameter to the new column.
Depending on how often this case is likely to be reused should help determine how to approach it. If it sounds like it might become a regular process.... "Oh can we have another report with the same filter but showing xyz " then take the time to setup correctly and it will save time in the future.
Personally I would add a database table, if possible, that contains the status names and then a status group name (ignoring fully normalising for the sake of simplicity here).
CREATE TABLE StatusGroups(Status varchar(10), StatusGroup varchar(10))
INSERT INTO StatusGroups VALUES
('IN_TRANSIT', 'In Process'),('RECEIVING, 'In Process'),('SHIPPED', 'In Process'),('WORKING', 'In Process'),('CLOSED' 'Closed')
Then a simple view
CREATE MyNewView AS
SELECT t.*, g.StatusGroup
FROM MyTable t
JOIN StatusGroups g on t.STATUS = g.Status
Now change your report dataset query to use this view passing in the report parameter like this...
SELECT *
FROM MyNewView
WHERE StatusGroup = #myReportParameter
Your dataset for your report parameter's available values list could then be something like
SELECT DISTINCT StatusGroup FROM StatusGroups
This way if you every add more status or statusgroup values you can add an entry to this table and everything will work without ever having to edit your report.
I'm hoping someone here might be able to help me with a Crystal Reports problem that's been bugging me on and off for days.
I have a report that is used as a picking slip for our warehouse staff to tell them which products to pack for each order that comes through our sales system.
The report contains all the products for the order and the quantities that need to be packed in the details section of the report which come from a number of joined tables.
My problem is that I have to then query the database again in order to get the total amount of items for each product on the order that have been packed across all orders throughout the warehouse.
The report datasource only returns records relating to the order on the picking slip so I need a sub query.
I've tried to use a SQL command with the following query:
SELECT ISNULL(SUM(QtyPacked), 0)
FROM tblPackingSlipLines
WHERE Status = 'Packed'
AND ProductId = '[ProductId]'
I'm stuck on passing the product id into the command as it is held in a text field on the report itself which is populated from tblProducts.ProductId (one of the joined tables).
Is it even possible to access this value from the command?
I've tried things like ProductId = '{tblProducts.ProductId}', #ProductId, ?ProductId and numerous other weird and wonderful permutations.
I can't use a parameter as that would require either user interaction; not possible as the report is auto generated by a Windows service or passing a static value in from the service.
I've also tried using a formula but that only pulls back the sum of QtyPacked for that distinct order line and not all packed orders in the DB:
SUM('{tblPickingSlipLines.QtyPacked}', '{tblProducts.ProductId}')
Any help would be greatly appreciated.
try using the sub report for this purpose.
Write your second query in sub report and pass the tblProducts.ProductId to the record selection parameter of the sub report through sub report links now your query comes in sub report as:
SELECT ISNULL(SUM(QtyPacked), 0)
FROM tblPackingSlipLines
WHERE Status = 'Packed'
AND ProductId = {pm-product ID}
I am attempting to join two datasets in to one tablix for a report. The second dataset requires a personID from the first dataset as its parameter.
If i preview this report only the first dataset is shown. but for my final result what i would like to happen is for each row of a student there is a rowgrouping (?) of that one students modules with their month to month attendance. Can this be done in report builder?
The best practice here is to do the join within one dataset (i.e. joining in SQL)
But in cases that you need data from two separate cubes(SSAS) the only way is the following:
Select the main dataset for the Tablix
Use the lookup function to lookup values from the second dataset like this:
=Lookup(Fields!ProductID.Value, Fields!ID.Value, Fields!Name.Value, "Product")
Note: The granularity of the second dataset must match the first one.
We had a similar issue and that can be resolved this way.
First of All, ensure the first data set's query and second data set's query are working fine by executing separately on the Database client tool such as Datastudio.
Build two data sets on SSRS tool with the respective queries and make sure both the data sets have same key column (personID).
On the SSRS report design, create a table from tool box and add the required columns from the first data set along with the matching key column(personID). Add a new column and use look up function to get the required column from the other data set against the same key column (personID).
I need help making only one (complete) Pie Chart show up when using GROUP BY in my query (SQL) using iReport 4.6.0.
I need to create a report using iReport (4.6.0; I am using the standalone version, not the NetBeans Plug-in) using data pulled from an SQL database. Basically, I'm trying to create a Pie Chart of what percentage of people in the DB are male and what percentage are female.
At first I tried doing two separate queries to extract this information:
SELECT COUNT('person_id') FROM 'table' WHERE 'SEX' = 'M';
SELECT COUNT('person_id') FROM 'table' WHERE 'SEX' = 'F';
I tried putting both of these queries into the Report Query dialog box, but iReport apparently only handles one query at a time. I also tried using UNION.
I then attempted (and am currently using):
SELECT COUNT('person_id') FROM 'table' GROUP BY 'sex'
This has given me limited success. It creates the chart that I need, but also creates additional, superfluous charts with only part of the data. It appears that each time iReport hits a new "group" from the query, it creates a new chart with the information with that group's data in addition to any data from previous groups (ie. in this case, it created 2 Pie Charts, one which showed only the female members of the DB and one which showed both male and female members). This theory was also tested by adding a new category in the DB (M, F, U) to see whether it would create 3 charts; it does (first with just female, second with male and female, third with male, female, and unknown).
The chart which interests me is the last one, the one which shows the data from all the groups. Can you guys help me in figuring out how to get only that last, complete Pie Chart?
Put the chart in the Title or the Summary band. Make sure its evaluation time is set to 'Report'.
I'm trying to create a report that will contain two pie charts. I get the data for the report from SQL.
Currently, I created a dataset for the first chart which holds records with the following fields: Import ID, Date, Status. This dataset contains duplicate records.
For the second chart, I need the same data I have in the first dataset, only without duplications and aggregated differently.
I realize that I can create another dataset that will get the distinct values from the SQL database, but I was wondering if there was a way to use the built-in filtering functionality to filter out the dataset I already have to return only distinct values (based on ID field).
Looking at the options in the following filtering dialog, I see no obvious way to do this:
If ID is not unique and your 1st query looks like this:
select ImportID, Date, Status
from YourTableSource
WHERE YourConditions
Then you probably should use for your 2nd query form like this:
select DISTINCT ImportID, Status
from YourTableSource
WHERE YourConditions
If changing the query is not an option ,then you may create the Group in ssrs with invisible DETAIL pane and place the ID and Status fiels in int Group pane