DataGrid, SQLite and texts with return
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
DataGrid, SQLite and texts with return
Hello community
I have the following problem:
I'm filling a DataGrid from an SQLite database, so far so good.
Now the problem. I have a field that serves as an InfoText field and of course a text with "return" is stored there. When saving to the SQLite database there is no problem but when I try to fill the DataGrid again there are problems because every return is interpreted as a new line.
How can I get a multiline text that contains several return lines to be interacted with in the DataGrid?
I have the following problem:
I'm filling a DataGrid from an SQLite database, so far so good.
Now the problem. I have a field that serves as an InfoText field and of course a text with "return" is stored there. When saving to the SQLite database there is no problem but when I try to fill the DataGrid again there are problems because every return is interpreted as a new line.
How can I get a multiline text that contains several return lines to be interacted with in the DataGrid?
-
- VIP Livecode Opensource Backer
- Posts: 9785
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: DataGrid, SQLite and texts with return
Hi.
Prepare a dataSet that is tab and return delimited, either as an array or as clear data. The DG will accept that directly, by setting the DGText or the DGData.
Craig
Prepare a dataSet that is tab and return delimited, either as an array or as clear data. The DG will accept that directly, by setting the DGText or the DGData.
Craig
Re: DataGrid, SQLite and texts with return
and how do I do that? without whom a return in a field is it does not make me a new line?
-
- VIP Livecode Opensource Backer
- Posts: 9785
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: DataGrid, SQLite and texts with return
Hi.
Now I am not sure what you mean. A datGrid is a large complicated beast, but the data it holds is available in part with native calls to its API, or in its entirety with the properties "DGData" or the "DGText". Getting and setting these last is how I usually deal with DG's.
If I wanted to insert three lines, inserted after, say, the current line 6 of the DG, one might:
Untested, but should work. What do you need that is different? Remember that those three lines must contain tab and return delimited data.
Craig
Now I am not sure what you mean. A datGrid is a large complicated beast, but the data it holds is available in part with native calls to its API, or in its entirety with the properties "DGData" or the "DGText". Getting and setting these last is how I usually deal with DG's.
If I wanted to insert three lines, inserted after, say, the current line 6 of the DG, one might:
Code: Select all
get the DGText of group "yourDatagrid"
put return & yourThreeLines after line 6 of it
set the DGText of group "yourDataGrid to it
Craig
-
- VIP Livecode Opensource Backer
- Posts: 9785
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: DataGrid, SQLite and texts with return
Is it that you want three "ordinary" lines, delimited by returns as is usual, to load into a single line in the DG? If so, just strip out the returns:there are problems because every return is interpreted as a new line.
How can I get a multiline text that contains several return lines to be interacted with in the DataGrid?
Code: Select all
replace return with "" in yourData
Code: Select all
replace return with space in yourData
Craig
Re: DataGrid, SQLite and texts with return
I can see the issue you're describing - using dgText and dgData will be an issue if your text contains carriage returns and create extra lines as you describe.
Of course one way to do this is to get rid of returns, but his may not suit your purposes.
I don't know how others have solved this, but one possible way to go about it would be to store the data in a custom property as an array, then populate the column using the fillInData pData event in the behaviour script (you'd need to create a column behaviour or row template beforehand if you're using a grid or form respectively). That way you'd fill the column with the actual data you retrieve from your database (with carriage returns and all).
Possibly there is a slicker way of doing this, but i'm fairly sure the above would work too...
Of course one way to do this is to get rid of returns, but his may not suit your purposes.
I don't know how others have solved this, but one possible way to go about it would be to store the data in a custom property as an array, then populate the column using the fillInData pData event in the behaviour script (you'd need to create a column behaviour or row template beforehand if you're using a grid or form respectively). That way you'd fill the column with the actual data you retrieve from your database (with carriage returns and all).
Possibly there is a slicker way of doing this, but i'm fairly sure the above would work too...
-
- VIP Livecode Opensource Backer
- Posts: 9867
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: DataGrid, SQLite and texts with return
Details on the problem, with a solution handler:
http://www.fourthworld.com/embassy/arti ... t-die.html
http://www.fourthworld.com/embassy/arti ... t-die.html
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
Re: DataGrid, SQLite and texts with return
Hello, everybody,
I have solved my problem completely.
i have created a second table in the database in which the info text with all characters a user can think of is stored and then i call it up separately in relation to the ID of the first table and put it in an extra field.
thank you for your effort i am sure i will ask for your help more often in the near future.
I have solved my problem completely.
i have created a second table in the database in which the info text with all characters a user can think of is stored and then i call it up separately in relation to the ID of the first table and put it in an extra field.
thank you for your effort i am sure i will ask for your help more often in the near future.