View Full Version : Need help with dataset
briguy151
06-18-2004, 10:59 AM
I need help I am trying to pul data from a database using Cold fusion and it seems that no matter how I write the xml it will not pick up the data. I am just starting out with this so any help would greatly be appreciated.
Brian
antun
06-18-2004, 11:02 AM
Could you give us a little more to go on? Can you access your ColdFusion script using a browser? How are you declaring the dataset in Laszlo, and how are you making the request?
-Antun
briguy151
06-18-2004, 11:07 AM
HEre is the lzx page
<canvas height="50" width="700" bgcolor="#D4D0C8">
<dataset name="dset" type="http" src="http://localhost:8500/lazlo_test/contacts.cfm" autorequest="true"/>
<simplelayout axis="y"/>
<view name="list" datapath="dset:/phonebook/contact">
<simplelayout axis="x"/>
<text datapath="@firstName"/>
<text datapath="@lastName"/>
<text datapath="@phone"/>
<text datapath="@email"/>
</view>
</canvas>
And the cfm page runs fine in the browser.
antun
06-18-2004, 11:16 AM
It helps to have the debugger on when you're writing Laszlo apps:
<canvas debug="true">
... then you can add an ondata event handler to the dataset to notify you when data has returned:
<dataset name="dset" type="http" src="http://localhost:8500/lazlo_test/contacts.cfm"
autorequest="true"
ondata="Debug.write('response received')" />
You can also execute code on the fly in the debugger, e.g.:
dset.serialize()
... to see what came back.
Looking at your LZX code, I'd expect your XML to be in the form:
<phonebook>
<contact firstName="foo" lastName="bar" phone="555-1212" email="foo@bar.com" />
<contact firstName="two" lastName="bar" phone="555-1212" email="two@bar.com" />
</phonebook>
Is that what you're getting?
-Antun
briguy151
06-18-2004, 11:37 AM
OK, I tested out the ondata and the debugger came back with
With variable set to xml values
"data conversion error for http://localhost:8500/lazlo_test/contacts.cfm: Parsing XML: end tag name 'td' must match start tag name 'body' (p"
With cfxml
"data conversion error for http://localhost:8500/lazlo_test/contacts.cfm: Parsing XML: unexpected character in markup (position: START_TAG seen ...e = source.parentElement.parentElement ;\r\n\t\t\tfor ( var i = 1; i < ... @205:25) "
Then it cut off,
This is what the variable prints when I write to a file
<phonebook> <contact firstname="Mike" lastname="last1" email="test@test3.com"> <contact firstname="Brian" lastname="last2" email="test@test2.com"> <contact firstname="first3" lastname="last3" email="test@test1.com"> </phonebook>
antun
06-18-2004, 11:39 AM
"data conversion error for http://localhost:8500/lazlo_test/contacts.cfm: Parsing XML: end tag name 'td' must match start tag name 'body' (p"
That sounds suspiciously like your ColdFusion script is wrapping the XML you're writing out with it with HTML tags.
If you view contacts.cfm in your browser, then view source, what do you see?
-Antun
briguy151
06-18-2004, 11:53 AM
you hit the nail on the head. Seemed that since my machine was set for debugging of cfm it showed up on the source when I requested the page thru Laszlo.
Thanks for the help.
Pabligula
12-21-2004, 12:11 AM
I tested the page on the browser, everyting works fine. No debug cfm code or any of those things. I added a text log on my page (so i can know when it is called)
(I'm using the same xml and lzx code used in the past posts)
This is the cfm code:
<phonebook> <contact firstname="Mike" lastname="Lastname<cfoutput>#Now()#</cfoutput>" email="test@test3.com"></phonebook>
<cffile action="append" file="c:\textos.txt" output="test#now()#">
So the cfserver shows the xml and saves the word test and a timestamp in c:\textos.txt
This is the lzx file:
<canvas height="500" width="700" bgcolor="#D4D0C8" debug="true">
<dataset name="dset" type="http" src="http://192.168.1.103/equilibrio/textos.cfm"
autorequest="true"
ondata="Debug.write('response received')"
/>
<simplelayout axis="y"/>
<view name="list" datapath="dset:/phonebook/contact">
<simplelayout axis="x"/>
<text datapath="@firstName"/>
<text datapath="@lastName"/>
<text datapath="@phone"/>
<text datapath="@email"/>
</view>
</canvas>
I'm testing from 192.168.1.100...
Nothing gets saved on the text log (at 192.168.1.103), and nothing on the debuger screen.
jg4smile
12-29-2004, 10:27 PM
i was having the same problem you were. i followed the example app, CF displayed a well-formed XML, and in development...NOTHING!
i'm not sure if this is what you are experiencing, but it appears that the Eclipse Laszlo IDE has trouble loading remote data. i copied and pasted my code into the Laszlo Explorer demo windows and everything worked like a charm.
there was one stange thing though...when attempting to access data from 127.0.0.1, i received:
data source error for http://localhost/test/web_service/getcontacts.cfm: HTTP Status code: 401:Unauthorized
...but after uploading the file to my site, it ran fine. there are million directions i can go with this from SP2 to my Norton firewall to my WIndows firewall. any thoughts?
and does anyone have any idea how to get the Eclipse Laszlo IDE to read data from remote locations and not just from a standard XML file?
Thanks everyone and i'm not throwing in the towel yet as some of my other peers have...
wdj
Pabligula
12-31-2004, 03:33 PM
Well, my problem is gone now, I was using the eclipse IDE, and discovered that if you use remote data, you have to run your laszlo app, in the lazlo server, not the IDE, the prevew will create the swf file, but the remoting wont work. so I copied the lzx file to the server folder and now it works.
jg4smile
01-06-2005, 04:40 PM
Basically, that's what I thought (I was looking for confirmation). I am going to work on at least methodology for working with Eclipse and Laszlo so that the remoting will not be a pain. Maybe create the XML files in the development are...I dont know yet, but when I do, I will be back.
Actually, I bet that you could create a local container with the XML data...well gimme a few days (weeks/months) to figure something out, but I am on it (that is all that is missing from the IDE).
wdj
antun
01-06-2005, 04:43 PM
I've seen this before, and agree it is frustrating. Hopefully a future release of the Eclipse plugin should either fix the issue or tell developers that data requests won't work.
-Antun
Well, my problem is gone now, I was using the eclipse IDE, and discovered that if you use remote data, you have to run your laszlo app, in the lazlo server, not the IDE, the prevew will create the swf file, but the remoting wont work. so I copied the lzx file to the server folder and now it works.
vBulletin® v3.8.4, Copyright ©2000-2012, Jelsoft Enterprises Ltd.