Preserving line breaks in Base

Discuss the database features

Preserving line breaks in Base

Postby alexander.kroh » Wed Jun 16, 2010 10:20 pm

Greetings all

I'm attempting to preserve line breaks that exist in the form that I've created. The field type that the text box inputs information into is Text[VARCHAR_IGNORECASE].

The form shows information as such:

Item 1
Item 2
Item 3

The table shows information as such:

Item1Item2Item3

How can I keep the formatting that exists in the form? Furthermore, I want to copy this information into Calc, save it as a CSV file and import the information into Greenstone. This last part is probably an entirely separate issue, but if anyone can help with the issue within Base, that would be much appreciated!
OOo 3.2.0
000320m12 (Build:9483)

Mac OS X 10.6.3
alexander.kroh
 
Posts: 2
Joined: Wed Jun 16, 2010 10:02 pm

Re: Preserving line breaks in Base

Postby RPG » Wed Jun 16, 2010 11:21 pm

Hello

Make a query in wich you show the data in the way you want.
This is the || symbol to concat two field in the query and maybe you need a name
For the query read this.
Code: Select all   Expand viewCollapse view
select "field1" || "field2" as "Newfield" from "table"

When your query is correct then close the database and open calc with the databrowser with F4.
Drag your data in your spreadsheet.

Romke
LibreOffice 6.2.5.2 on openSUSE Leap 15
RPG
Volunteer
 
Posts: 2176
Joined: Tue Apr 14, 2009 7:15 pm
Location: Netherlands

Re: Preserving line breaks in Base

Postby alexander.kroh » Thu Jun 17, 2010 3:24 am

Thanks for the reply. However, I think I wasn't clear enough: All of my information is in one field. I think what you are suggesting is if I'm trying to display information from multiple fields.

It is a text box for data entry in the form view. The text box is formatted to allow multiple lines. I only put one piece of information per line so that it is easier to read like a list.

Item 1
Item 2
Item 3

However, in the table view, it ignores the line returns (and spaces) and displays

Item1Item2Item3

It seems like a simple formatting/preference that I'm not finding.

I've also seen, when you double click on a text box in the form design view, that there is an option called "text lines end with" and gives the options CR + LF (Windows) or LF (Unix). I believe this is a way to denote the end of a text line but I'm not sure how it is used. Am I on the right track?
OOo 3.2.0
000320m12 (Build:9483)

Mac OS X 10.6.3
alexander.kroh
 
Posts: 2
Joined: Wed Jun 16, 2010 10:02 pm

Re: Preserving line breaks in Base

Postby RPG » Thu Jun 17, 2010 11:46 am

Hello

I think what you want is not possible. The property you mean is not for that purpose you think.

I think you have to re-design your database. Make one more table and put all the values who are in the text box in the new table.

Romke
LibreOffice 6.2.5.2 on openSUSE Leap 15
RPG
Volunteer
 
Posts: 2176
Joined: Tue Apr 14, 2009 7:15 pm
Location: Netherlands

Re: Preserving line breaks in Base

Postby Arineckaig » Thu Jun 17, 2010 1:26 pm

How can I keep the formatting that exists in the form? Furthermore, I want to copy this information into Calc, save it as a CSV file and import the information into Greenstone.


I regret Greenstone is way above my pay grade, and my tests using MS XP may not apply to Apple. I offer, however, some results when copying from Base to Calc and CSV. You have formatted the text box to permit multiple lines. As you will have seen the lines are displayed as you require in the form but as a single line unless using a Memo Data Type with increased row height when its data source Table is opened.

The line returns should have been recorded in the Table. I copy below a couple of lines from an SQL Script dump of a test that I ran:

INSERT INTO "MemoTable" VALUES(0,'This is a test\u000d\u000aI have added a second line')
INSERT INTO "MemoTable" VALUES(4,'This is the second\u000aPart of the test\u000aNo formatting is ever required\u000a')

You will see that data for the first record was written with CR/LF as the line delimiter and the second merely with the Unix LF. My aim was to test what would be the impact of the different delimiters. Strangely it would not appear to be material.

I then copied the Table from Base into a new Calc spreadsheet using the f4 Beamer route and saved that Calc file AS .csv using a comma as the field and double quotes as the text delimiters respectively. A Hex dump of the resulting CSV file shows the two types of line delimiters do copy without change. The CSV file, however, happily opens in WordPad as shown below:

"ID","Memo"
0,"This is a test
I have added a second line"
4,"This is the second
Part of the test
No formatting is ever required
"

It does appear with MS Windows that you should be able to maintain your line breaks through into CSV and that it is not necessarily material which line delimiter you use. I wish you luck with your experiments.
When this issue has been resolved, it would help other users of the forum if you add the word - [Solved] - to the Subject line of your 1st post (edit button top right).
AOOo 4.1.5 & LO 6 on MS Windows 10 MySQL and HSQLDB
Arineckaig
Volunteer
 
Posts: 828
Joined: Fri Nov 30, 2007 10:58 am
Location: Scotland

Re: Preserving line breaks in Base

Postby evwool » Fri Jun 18, 2010 8:15 pm

alexander.kroh wrote:Thanks for the reply. However, I think I wasn't clear enough: All of my information is in one field. I think what you are suggesting is if I'm trying to display information from multiple fields.
It is a text box for data entry in the form view. The text box is formatted to allow multiple lines. I only put one piece of information per line so that it is easier to read like a list.
Item 1
Item 2
Item 3

I have to ask, Alexander: why oh why would you do such a thing? I've tried and I can't think of a single circumstance where a list of items would be put into a single field. Multiple-line text boxes are usually just a way of displaying long fields rather than a way of presenting lists. It just wraps the data. Lists of items would normally be part of of your database design and each record would hold a different item, grouped so that data can be extracted in a meaningful way. Or, if the 3 lines represented say address details then you would use 3 different fields.
OpenOffice 3.1.1 on Windows XP and on Windows 7 Starter
evwool
Volunteer
 
Posts: 401
Joined: Fri Oct 09, 2009 9:40 pm
Location: UK

Re: Preserving line breaks in Base

Postby dieselmachine » Sun Jun 20, 2010 5:09 am

Here's a circumstance: Storing raw HTTP requests and responses.

That said, any idea how to fix this?
OpenOffice 3.0
Ubuntu 9.04 (Jaunty)
dieselmachine
 
Posts: 1
Joined: Sun Jun 20, 2010 5:06 am

Re: Preserving line breaks in Base

Postby Drewbacca » Sun May 22, 2011 2:31 am

The reason I need this information is that I want to put in an address in one box. Which contains at least two lines. Example:

Jimmy Johnson
4242 Thisway Dr
Minneapolis, MN 55434

I want to put this information into ONE box in a form. Any way to do this simply?
OpenOffice 3.2.0 on Windows XP
Drewbacca
 
Posts: 1
Joined: Sun May 22, 2011 2:28 am

Re: Preserving line breaks in Base

Postby Sliderule » Sun May 22, 2011 5:34 am

Drewbacca:

You said / asked:

Drewbacca wrote:I want to put this information into ONE box in a form. Any way to do this simply?


Yes.

You will need to create a Query . . . and . . . include in it, a 'calculated' field, containing the 'concatenated' fields. And, include in the 'concatenation' a line feed ( SQL function CHAR(10) ). :bravo:

Let me give you an example.

Assume you have field names of:

  1. "First_Name"
  2. "Last_Name"
  3. "Address"
  4. "City"
  5. "ST"
  6. "Zip"

In your Query, you could create a new 'calculated field' . . . with a name of "Full_Address" this way:

Code: Select all   Expand viewCollapse view
"First_Name" || ' ' || "Last_Name" || CHAR(10) || "Address" || CHAR(10) || "City" || ', ' || "ST" || '  ' || "Zip"


Now, in your Form, you can assign the 'box' with the name, from your Query . . . of . . . "Full_Address" .

IMPORTANT NOTE: For the multi-line field "Full_Address" , be sure in the Form Properties, Text Type, to assign it as, Multi-line.

I hope this helps, please be sure to let me / us know if this helps. :super:

Sliderule
User avatar
Sliderule
Volunteer
 
Posts: 1191
Joined: Thu Nov 29, 2007 9:46 am


Return to Base

Who is online

Users browsing this forum: No registered users and 5 guests