Page 1 of 1

Preserving line breaks in Base

PostPosted: Wed Jun 16, 2010 10:20 pm
by alexander.kroh
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!

Re: Preserving line breaks in Base

PostPosted: Wed Jun 16, 2010 11:21 pm
by RPG
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

Re: Preserving line breaks in Base

PostPosted: Thu Jun 17, 2010 3:24 am
by alexander.kroh
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?

Re: Preserving line breaks in Base

PostPosted: Thu Jun 17, 2010 11:46 am
by RPG
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

Re: Preserving line breaks in Base

PostPosted: Thu Jun 17, 2010 1:26 pm
by Arineckaig
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.

Re: Preserving line breaks in Base

PostPosted: Fri Jun 18, 2010 8:15 pm
by evwool
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.

Re: Preserving line breaks in Base

PostPosted: Sun Jun 20, 2010 5:09 am
by dieselmachine
Here's a circumstance: Storing raw HTTP requests and responses.

That said, any idea how to fix this?

Re: Preserving line breaks in Base

PostPosted: Sun May 22, 2011 2:31 am
by Drewbacca
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?

Re: Preserving line breaks in Base

PostPosted: Sun May 22, 2011 5:34 am
by Sliderule
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