Page 1 of 1

Help query displaying in datagrid..

Posted: Tue Jun 10, 2014 3:30 pm
by snop21
Good Day, Guys..

I am encountering a problem with my query.. I have a 14 columns in my database and it has 4 data on it. I query it and display it to datagrid my problem was
in the datagrid it doesn't return the 4 rows of my database supposed to be it will return the 4 rows. I attached the screen shot.

Any help is very much appreciated.

my script
---------------

put revOpenDatabase("mysql","sql5.freemysqlhosting.net","sql542966","sql542966","sG4!dS3!") into conn1
put "select * from temptransaction" into query
put revDataFromQuery(,,conn1,query) into dt
set the dgText of group "Datagrid 1" to dt
revCloseDatabase conn1
put empty into conn1

------------------

Thank You, Livecoders..

Regards

-snop21

Re: Help query displaying in datagrid..

Posted: Tue Jun 10, 2014 3:39 pm
by Simon
Hi snop21,
From the lesson http://lessons.runrev.com/m/datagrid/l/ ... -with-data
pText is assumed to be a collection of data where each row is delimited by the return character and each item is delimited by a tab.
You dropped the columnDelim rowDelim from revDataFromQuery.

Is that enough?

Simon

Re: Help query displaying in datagrid..

Posted: Tue Jun 10, 2014 4:24 pm
by bangkok
I would say : your data contains CR and/or LF.

With

Code: Select all

put revDataFromQuery(,,conn1,query) into dt
LiveCode will use (per default) tab as column delimiter and return (CR) as row delimiter.

So if one of your column contains a CR, LiveCode will see "new row". Hence the twisted display.

Solution :
-clean the data you record in your database, by removing CR etc.
-or :

Code: Select all

put revDataFromQuery(,"|",conn1,query) into dt
replace CR with " " in dt
replace LF with " " in dt
replace "|" with CR in dt
set the dgText of group "Datagrid 1" to dt