[Solved] How to remove unwanted spaces in report text

Getting your data onto paper - or the web - Discussing the reports features of Base
Post Reply
mikewatkins727
Posts: 2
Joined: Fri Mar 11, 2011 10:18 pm

[Solved] How to remove unwanted spaces in report text

Post by mikewatkins727 »

I have built a database, queries and reports in OO Base 3.3.0. The reports have an address element from which I want to remove the extra spaces for the names and city names. In the database definitions the names and address fields are field type Text [VARCHAR] with a length of 50. In the report (using Oracle Report Builder ver 1.2.1) the fields for address element are in blocks of 50 characters (such as first name, last name, city, spouse, etc.). When I execute the report the data is correctly presented but it is in blocks of 50 characters. What I am striving for is:

John Q. Citizen
123 Any Street
Any Town, OH 45000

Any help would be appreciated.

Mike
Attachments
Untitled 1.odt
Generated address element from a report.
(9.77 KiB) Downloaded 255 times
Last edited by mikewatkins727 on Mon Mar 14, 2011 2:52 pm, edited 2 times in total.
OpenOffice 3.3.0
MS Vista
mikewatkins727
Posts: 2
Joined: Fri Mar 11, 2011 10:18 pm

Re: How to remove unwanted spaces in report text

Post by mikewatkins727 »

Found the SQL code CASE WHEN...THEN...ELSE and used it to concatenate the text to meet the conditions I need to print on the report. Thanks to r4zoli's post on the the use of double quote, single quote, concatenate (||) and the wild card symbol. In my database I had fields for first name, last name and spouse. Not everyone has a spouse but I needed a way to concatenate the names into an address element for a letter. I used the following syntax to do the work:

CASE WHEN "Spouse" IS EMPTY THEN "First name" || ' ' || "Last name" ELSE "First name" || ' & ' || "Spouse" || ' ' || "Last name" END

Thanks to this forum I found the tools I needed to do the job.
OpenOffice 3.3.0
MS Vista
Post Reply