Differentiate between columns from rows in query

Getting your data onto paper - or the web - Discussing the reports features of Base
Post Reply
Ron19855
Posts: 10
Joined: Thu Dec 27, 2018 11:25 pm

Differentiate between columns from rows in query

Post by Ron19855 »

 Edit: Moved from Writer forum to Reporting 
Hello,

I have a query that queries all the items belonging to a particular order number. I want to create a report that pulls data from this query and generates a receipt. Here is an example, note that Record/fullName and ITEM/PRICE are from different tables.

When I select multiple rows as-is, it prints each row to a different page. Is there a way to have all Items print as a list on the same page. Is there a method in which I can specify to print all ITEM columns where Record equals 530? If not, is there a way to concat ITEMS in the query so they all appear in one column in the query? Open to any method that could solve this problem. Any assistance will be greatly appreciated. Thank you. (Note: I am using MySQL as my database)
11.PNG
OpenOffice 4.1.6 - Windows 7 Ultimate
FJCC
Moderator
Posts: 9270
Joined: Sat Nov 08, 2008 8:08 pm
Location: Colorado, USA

Re: Differentiate between columns from rows in query

Post by FJCC »

How are you transferring the information from the database to the Writer file? If I select some rows from the data source window by Ctrl + Clicking on the gray boxes at the left edge of the rows and then dragging the rows into a Writer document, I get a table.
OpenOffice 4.1 on Windows 10 and Linux Mint
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
Ron19855
Posts: 10
Joined: Thu Dec 27, 2018 11:25 pm

Re: Differentiate between columns from rows in query

Post by Ron19855 »

I have the placeholders set beforehand. This makes it simpler because I don't have to make any changes to the formatting of my report. When I select print, the placeholder fields are automatically populated depending on the row in my table/query I select. Is there a way to maintain using this method but have multiple rows corresponding to the same primary key print on one page instead of a different page for each entry? You method of holding control is nice, but it less convenient then just selecting the record and having it populate.
OpenOffice 4.1.6 - Windows 7 Ultimate
FJCC
Moderator
Posts: 9270
Joined: Sat Nov 08, 2008 8:08 pm
Location: Colorado, USA

Re: Differentiate between columns from rows in query

Post by FJCC »

You can get a table that has all of the rows where Record = 530 by writing a query like

Code: Select all

SELECT "fullName" AS "NAME, "ITEM", "PRICE" FROM "MyTABLE" WHERE "Record" = :ChooseRecord
Then dragging the whole query from the left hand listing of tables and queries into the Writer document. You will be prompted to pick the columns to insert and then asked for a value of ChooseRecord.
Will that work for you?
OpenOffice 4.1 on Windows 10 and Linux Mint
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
Mountaineer
Posts: 311
Joined: Sun Sep 06, 2020 8:27 am

Re: Differentiate between columns from rows in query

Post by Mountaineer »

Ron19855 wrote:I have the placeholders set beforehand. This makes it simpler ...
In one of my reports i use a special field "next row" thst can be embedded in the writer-template using the connection like a serial letter.

If I repeat my setup of fields + "next row" 5 times on a page I get 5 rows of my database per page.

You may have to find out, how next-row is labeled, I did this some time ago in german language, so I don' know the english label.

J.
OpenOffice 3.1 on Windows Vista
Post Reply