I have a Crystal Reports rpt-file, that contains 2 queries. (One for the main report, and the other for the subreport.)
The user gives a parameter ("DocNum") for the main report, that connected with a key field ("DocEntry") to the subreport.
The problem is, that in this case it takes too long time to generate the report, because the Crystal Reports reads the all records to the memory, and just than creates the rpt-file.
Query of the main report:
SELECT DocNum, DocEntry, CardCode FROM OINV WHERE DocNum = {?DocNum}
Query of the subreport:
SELECT ItemCode, Dscription FROM INV1
Is there any solution, that passing the key fields value ("DocEntry") to the subreports query as a "where condition"?
Something like this:
SELECT ItemCode, Dscription FROM INV1 WHERE DocEntry = {...}
Yes, this is known as Linked subreport.
Right-click the subreport and select 'Change Subreport Links...'
Related
My Query creates lots of entries because there are a lot of entries for dates in the view, and when I try to filter out the information in report builder it doesn't divide the pie graph into four pieces but divides it into the number of date entries in the view.
What I am supposed to do is get number parts sold for each class between dates. The dates are to be selected in report builder.
SQL Developer Query:
CREATE OR REPLACE VIEW QUERY3 AS
SELECT partclass, COUNT(p.partno) AS "Parts Sold", orderdate
FROM part p, salesorder s, orderprod o
WHERE p.partno = o.partno
AND o.orderno = s.orderno
GROUP BY partclass, orderdate;
Report Builder Query
SELECT * FROM QUERY3
You didn't post a query you use in Reports Builder. Apparently, you'll need to include a WHERE clause which restricts the result set by dates. Something like this:
select partclass, "Parts Sold", orderdate
from query3
where orderdate between :par_date_from and :par_date_to; --> this
A side note: consider recreating the view and naming the "Parts Sold" column differently, such as parts_sold. The way you put it, you'll always have to reference that column using double quotes and paying attention to mixed case.
:par_date_from and :par_date_to represent references to parameters you should create in the report. If you use the built-in Parameter Form, you'll be prompted to enter those values. Or, if you run the report differently, you'll have to pass those values to the report in order to use them.
I am new to access. I have a report with a query(Q1) as its data source. Is it possible to use another query(Q2) only for one field in the same report?
My main query is:
SELECT PersonTotalHours.*, Person.*
FROM PersonTotalHours
INNER JOIN Person
ON PersonTotalHours.LastName = Person.LastName;
My report's structure is like this:
Report header
_____________
Page header
_____________
Lastname header
_____________
report details
_____________
Lastname Footer
_____________
PageFooter
As you can see, in the report I group my data using the Lastname column then I show details about each peron for current year.
I need to show short form of data about former years of each person in the Last name header (somewhere before the detailed data).
Second query is like this:
SELECT PersonTotalHours.MA, PersonTotalHours.Year, Sum(PersonTotalHours.Hours) AS Sum
FROM PersonTotalHours
GROUP BY PersonTotalHours.MA, PersonTotalHours.Year
I use this for short form of data.
Important point is that the number of rows can be different. Person A might have 0 previous years and another person has more than 5.
How is it possible to use the second query for parts of report data?
I solve the problem using a subreport.
http://www.simply-access.com/Multiple-Queries-in-Report.html
I've got two reports that I wish to combine into one print off. Report1 is a 2 page report and has an ID parameter, Report2 is a 1 page report and also has the same ID parameter. The ID's come from a separate query dataset1
SELECT id FROM users WHERE firstname = 'Dave'
I want there to be 3 pages per id. I have tried putting two subreports into a List, where the list has a dataset linked to my SELECT query, but this displays all of the Report1's and then all of the Report2's after.
Desired output: (Report1pg1[id=1], Report1pg2[id=1], Report2pg1[id=1]), (Report1pg1[id=2], Report1pg2[id=2], Report2pg1[id=2])
I am not sure and i don't have no data tools installed in my current machine to check.
But I think the following logic will work.
Try grouping with id in Report1 and in detail portion add subreport and call Report2 (assuming that you are using table)
I have a report that is supposed to show the Stock Value of products before and after conversion.
I have the source products product code and stock value displayed on the form, now I need to get the value of the items converted from that one piece of stock.
I assumed this would be possible to achieve using some simple SQL to calculate the sum of all resulting products with the same SCID (Stock Conversion ID). My SCID is used to link a source product to a number of resulting products in a different table.
In this image I have named the SCID boc in the detail section sSCID to try and differentiate it from any fields in tables that it may try to pick up. But basically I need to get the code to look for result products that match the SCID displayed in that box and add them all together to get the sum total of converted stock.
If context helps I am trying to create a form that shows the value of stock before and after a conversion process in order to try and calculate the wastage.
Thanks,
Bob P
You can either use DSum or build your report query to include the calculation. I would prefer the second option. This assumes that SCID is numeric, you would need quotes for a text SCID.
=DSum("sValue","[Stock Conversion Items]","SCID=" & sSCID)
Or
SELECT r.This,r.That,s.ConvValue
FROM ReportTable r
INNER JOIN (
SELECT SCID, Sum(sValue) As ConvValue
FROM [Stock Conversion Items]
GROUP BY SCID) s
ON r.sSCID = s.SCID
The above query uses aliases r and s for the tables : ReportTable r or ReportTables As r
1 Is it possible to pass data from ssrs 2005 subreport to its parent report?
2 If yes, how?
Thanks so much
Philip
Create two datasets - one for the main report one that is the same used in the sub report.
Add your sub report but grab the total from the second dataset on the main report.
I'm not actually taking the info from the sub report. I'm only using the sub report to display the information correctly. I'm using the second dataset just to total what's in the sub report.
=Sum(Fields!Total.Value, "DataSource1") + Sum(Fields!ThinkTotal.Value, "ThinkCharge")
You might be able to add a subquery to the query in the main report to get totals:
SELECT
t1.ClientID,
t1.Address,
-- Subquery to get invoice totals:
(SELECT SUM(InvoiceTotal)
FROM Invoices
WHERE Invoices.ClientID = t1.ClientID)
AS InvoiceTotal,
t1.CompanyName
FROM Clients t1;
Its has been posted on another forum that this cannot be done :(