Multi-line Data

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
2hup
Posts: 24
Joined: Tue Nov 17, 2015 8:03 pm

Multi-line Data

Post by 2hup » Wed Nov 18, 2015 5:48 pm

Hello LiveCoders! It is me again! :D

So, I have some multi-line data (contains returns) stored in a sqlite table - like...

"Line 1
Line 2
Line 3 "

I must be doing something wrong. I have tried a scrolling list field as well as a data grid and both put each line in a separate row.

quailcreek
Posts: 746
Joined: Sun Feb 04, 2007 11:01 pm

Re: Multi-line Data

Post by quailcreek » Wed Nov 18, 2015 8:24 pm

So how is the data stored in the database and what do you want it to look like in your field?
Tom
MacBook Pro OS Mojave 10.14

2hup
Posts: 24
Joined: Tue Nov 17, 2015 8:03 pm

Re: Multi-line Data

Post by 2hup » Wed Nov 18, 2015 9:03 pm

quailcreek wrote:So how is the data stored in the database and what do you want it to look like in your field?
The field is stored in the database just as I show in original post - a string (text) with return characters in it, making it a multi-line.
IMO, there could be three options - 1) the row height expands to accomodate (which I think could be problematic) or 2) the first line is displayed and other lines do not show, or 3) would be the way the data is displayed in the browse window of sqllite browser - where you just cannot see the line breaks and the lines get jammed together until the row height is expanded.

2hup
Posts: 24
Joined: Tue Nov 17, 2015 8:03 pm

Re: Multi-line Data

Post by 2hup » Wed Nov 18, 2015 9:27 pm

Here is how it is shown in the datagrid. The last 3 lines should be 1 row from the database.
Screen Shot 2015-11-18 at 1.20.11 PM.png

2hup
Posts: 24
Joined: Tue Nov 17, 2015 8:03 pm

Re: Multi-line Data

Post by 2hup » Wed Nov 18, 2015 9:39 pm

Here is the data in sqllite browser...
Screen Shot 2015-11-18 at 1.38.03 PM.png
Screen Shot 2015-11-18 at 1.38.03 PM.png (20.13 KiB) Viewed 7440 times

quailcreek
Posts: 746
Joined: Sun Feb 04, 2007 11:01 pm

Re: Multi-line Data

Post by quailcreek » Wed Nov 18, 2015 9:47 pm

If you store a field that has CRs into the database it will show in the table on one line eventhough the CRs are still there. When you pull that data into the dataGrid the CRs come along too.
Tom
MacBook Pro OS Mojave 10.14

2hup
Posts: 24
Joined: Tue Nov 17, 2015 8:03 pm

Re: Multi-line Data

Post by 2hup » Wed Nov 18, 2015 9:58 pm

quailcreek wrote:If you store a field that has CRs into the database it will show in the table on one line eventhough the CRs are still there. When you pull that data into the dataGrid the CRs come along too.
Thanks Tom,
Yes, I do want all the data, CR's and all. I just want to be able to select one row representing that data. Currently, I have not found a way to get the data to show up in the grid as it does in sqllite browser. (please see above illustrations).

quailcreek
Posts: 746
Joined: Sun Feb 04, 2007 11:01 pm

Re: Multi-line Data

Post by quailcreek » Wed Nov 18, 2015 10:57 pm

The screen shots show the issue. However, we will need to see your code in order to diagnose the problem and provide a solution.

Try replacing the cr with numToChar(11), it's a soft return that keeps the line together. 11 is the ascii char

Look up numToChar() in the dictionary.
Tom
MacBook Pro OS Mojave 10.14

2hup
Posts: 24
Joined: Tue Nov 17, 2015 8:03 pm

Re: Multi-line Data

Post by 2hup » Thu Nov 19, 2015 12:00 am

quailcreek wrote:The screen shots show the issue. However, we will need to see your code in order to diagnose the problem and provide a solution.

Try replacing the cr with numToChar(11), it's a soft return that keeps the line together. 11 is the ascii char

Look up numToChar() in the dictionary.

I have attached the project and the database. The path to the db is not relative, and is in the button script.

Thanks for taking a look at this.

Brad
Attachments
TestDataGrid.zip
(6.03 KiB) Downloaded 185 times

quailcreek
Posts: 746
Joined: Sun Feb 04, 2007 11:01 pm

Re: Multi-line Data

Post by quailcreek » Thu Nov 19, 2015 2:00 am

If you want the 3 lines to be in 1 row the CRs need to be replaced with numToChar(11). Post the code you use to save to the Db. Also, it's sqLite with 1 L.
Tom
MacBook Pro OS Mojave 10.14

2hup
Posts: 24
Joined: Tue Nov 17, 2015 8:03 pm

Re: Multi-line Data

Post by 2hup » Thu Nov 19, 2015 2:53 pm

The data wasn't created with code - it was from another source.

2hup
Posts: 24
Joined: Tue Nov 17, 2015 8:03 pm

Re: Multi-line Data

Post by 2hup » Thu Nov 19, 2015 9:15 pm

quailcreek wrote:If you want the 3 lines to be in 1 row the CRs need to be replaced with numToChar(11).
I replaced the "return" with the numToChar(11) like you suggested. You are right, it displays it as one line in the grid. Problem is, it displays that way in all controls.
I need this text to be multi-line in a control that is multi-line. I could convert the data on each record after it comes out of the database, but that is such a kludge. If there isn't a way to do this, my evaluation of LiveCode is likely over.

Please, someone tell me this is possible.

EDIT...
So I have a work-around that will keep me going. Please let me know if you all have any other information.

SparkOut
Posts: 2947
Joined: Sun Sep 23, 2007 4:58 pm

Re: Multi-line Data

Post by SparkOut » Fri Nov 20, 2015 8:46 am

If you make the datagrid a form style and customise the row template you can do this, but you will have to manage column headings separately.

Post Reply