Page 1 of 1

Multi-line Data

Posted: Wed Nov 18, 2015 5:48 pm
by 2hup
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.

Re: Multi-line Data

Posted: Wed Nov 18, 2015 8:24 pm
by quailcreek
So how is the data stored in the database and what do you want it to look like in your field?

Re: Multi-line Data

Posted: Wed Nov 18, 2015 9:03 pm
by 2hup
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.

Re: Multi-line Data

Posted: Wed Nov 18, 2015 9:27 pm
by 2hup
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

Re: Multi-line Data

Posted: Wed Nov 18, 2015 9:39 pm
by 2hup
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 7447 times

Re: Multi-line Data

Posted: Wed Nov 18, 2015 9:47 pm
by quailcreek
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.

Re: Multi-line Data

Posted: Wed Nov 18, 2015 9:58 pm
by 2hup
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).

Re: Multi-line Data

Posted: Wed Nov 18, 2015 10:57 pm
by quailcreek
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.

Re: Multi-line Data

Posted: Thu Nov 19, 2015 12:00 am
by 2hup
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

Re: Multi-line Data

Posted: Thu Nov 19, 2015 2:00 am
by quailcreek
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.

Re: Multi-line Data

Posted: Thu Nov 19, 2015 2:53 pm
by 2hup
The data wasn't created with code - it was from another source.

Re: Multi-line Data

Posted: Thu Nov 19, 2015 9:15 pm
by 2hup
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.

Re: Multi-line Data

Posted: Fri Nov 20, 2015 8:46 am
by SparkOut
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.