Bug 379694 - Parameter queries in reports do not work
Summary: Parameter queries in reports do not work
Status: CLOSED FIXED
Alias: None
Product: KEXI
Classification: Applications
Component: Reports and Printouts (show other bugs)
Version: 3.1.0 Alpha
Platform: Appimage Linux
: NOR major
Target Milestone: 3.1
Assignee: Adam Pigg
URL: https://phabricator.kde.org/D15438
Keywords:
Depends on:
Blocks:
 
Reported: 2017-05-10 12:58 UTC by Ian Whitfield
Modified: 2018-12-15 23:09 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In: 3.2.0


Attachments
Sample table (12.36 KB, image/png)
2017-05-11 22:51 UTC, Jarosław Staniek
Details
Parameter query (31.74 KB, image/png)
2017-05-11 22:52 UTC, Jarosław Staniek
Details
Parameter query in report (57.26 KB, image/png)
2017-05-11 22:52 UTC, Jarosław Staniek
Details
Report for query limited to 1 record (15.64 KB, image/png)
2017-05-11 23:01 UTC, Jarosław Staniek
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ian Whitfield 2017-05-10 12:58:31 UTC
I have a Members Database and from this, with a Query, I select a Group of the Members.
I then created a Report to print out or email a Report for each of these selected Members.

Problem 1 - I have >300 Members and the one Group is about 150 of these.
I can not find a way to select a particular Member to bring up the Report for him??!! The counter shows only how many in the selected Group and not the Table Record No.
I CAN do it manually by clicking through ALL the records one-by-one until I find the one I want. But this is a VERY slow method.

Problem 2 - Once I have the Report I want on screen I select "Report > Export as > PDF"
BUT it prints out the FIRST Report in the Group and NOT the one on-screen.

To do a lot of these it would be better if you could trigger the Report for the current Record on-screen from the Form. Is this possible??
Comment 1 Jarosław Staniek 2017-05-11 22:39:08 UTC
Answering for #1. 

I am copying the Problem #2 to another bug entry. Next time please use one entry per issue, OK?
Comment 2 Jarosław Staniek 2017-05-11 22:39:45 UTC
Ian,
Changed the summary to "Selecting record for printing".

The other problem is addressed at https://bugs.kde.org/show_bug.cgi?id=379737
Comment 3 Jarosław Staniek 2017-05-11 22:51:45 UTC
Created attachment 105461 [details]
Sample table
Comment 4 Jarosław Staniek 2017-05-11 22:52:00 UTC
Created attachment 105462 [details]
Parameter query
Comment 5 Jarosław Staniek 2017-05-11 22:52:42 UTC
Created attachment 105463 [details]
Parameter query in report
Comment 6 Jarosław Staniek 2017-05-11 22:53:00 UTC
So to select a record you can use parameter queries:

http://www.kexi-project.org/pics/1.1.1/parameter_query/parameter_query.html
Comment 7 Jarosław Staniek 2017-05-11 23:00:18 UTC
Example follows:
1. Table persons created: https://bugs.kde.org/attachment.cgi?id=105461&action=edit

2.  Parameter query created from this table, note that for the Criteria for ID I entered [Enter Person's ID]

3. Kexi asks for ID when the query is previewed. You enter 1 and record "Ian" appears.

4. Then create report based on the query. The report should ask for the parameter for the query then just one record should be displayed in the report.

Current issue: Step 4 does not work. (I changed the bug summary - most practical)
Comment 8 Jarosław Staniek 2017-05-11 23:01:12 UTC
Created attachment 105464 [details]
Report for query limited to 1 record
Comment 9 Jarosław Staniek 2017-05-11 23:01:52 UTC
Current workaround for you Ian: Once you find the record you want to print, copy the ID to clipboard, go to the query design, paste the ID in the criteria box for the ID field. Save the query, then open report based on the query (to refresh it you can go to design and switch back to data). Result: one record should be previewed. See https://bugs.kde.org/attachment.cgi?id=105464&action=edit
Comment 10 Ian Whitfield 2017-05-15 15:17:12 UTC
Not getting this at all Jaroslaw!!

I have a 300+ members Database
With a Query I select out a specific Group (Appoox 150)
I then design a Report for these Members
The Report correctly only has 150 listings
So How do I get to any specific Report to print out??

(Other problem is that if I click through to get to the one I want it still prints out the FIRST record in this Group!!!)
Comment 11 Jarosław Staniek 2017-05-15 15:37:07 UTC
OK but please define what do you mean by REPORT and GROUP here. Report is a single document in the project, like form or query is.

There is no GROUP term in Kexi.
Comment 12 Ian Whitfield 2017-05-15 17:05:06 UTC
"Report" is a Report created in Kexi.

"Group" is the Group of Members (with a particular status in the Database (ie all those who have not yet paid their fee or all of those in a particular area etc) and have been select from the Database with a Query.
Comment 13 Jarosław Staniek 2017-05-15 19:03:24 UTC
So do you want to print out one record out of these selected (approx. 150 records)?
Comment 14 Ian Whitfield 2017-05-15 22:29:07 UTC
No Jaroslaw

One for each of them.
Comment 15 Jarosław Staniek 2017-05-16 07:21:10 UTC
One per page i.e. 150 pages?
Comment 16 Ian Whitfield 2017-05-16 08:58:32 UTC
Yes - It is a once a year thing that has to be done

For the rest of the year there is just the need to do this whenever new people join the Organization.

I have also noticed that 'Print to Text File' does nothing.

Could not a 'Print' button be added to the Report screen to print (or save) the currently displayed Report??
Comment 17 Jarosław Staniek 2018-09-13 16:50:53 UTC
@Ian Please use another report for this another topic, thanks.
Comment 18 Jarosław Staniek 2018-09-13 16:53:12 UTC
Log:

git diff --stat f352f4ae9f17c18b5eef3af9ca226964b9c556af..719ee0c4ef068ce9837becce3bb6cd8abebcd821
src/plugins/reports/KexiDBReportDataSource.cpp | 20 +++++++++++++++-----
1 file changed, 15 insertions(+), 5 deletions(-)

https://phabricator.kde.org/D15438