View Full Version : invalid data path - no error
maritimesource
03-13-2006, 08:22 AM
Hi,
I just wasted 2 hours trying to figure out why my data wasn't being displayed. The datapath I used was:
<view name="rowOfData" datapath="myData:profiles/profile">
When it should be "myData:profiles/profile"
Why doesn't the compiler or something complain about an invalid datapath?
Thanks
Geoff2010
03-13-2006, 10:08 AM
probably because those are the same things.
maritimesource
03-13-2006, 10:11 AM
Whoops!
When it should be "myData:/profiles/profile"
without that first slash I was getting a blank view. Just an amateur typo, but wondering why I didn't get a compiler warning or error.
Thanks
Geoff2010
03-13-2006, 10:22 AM
it wouldn't be the compiler that would warn you about dataset issues. Most datasets are loaded long after the compiler has done it's work.
I am not sure if there is a way to get that condition to show up in the debugger. You could probably look at the base class to figure out what actually happens when the datapath is invalid.
kdavies
03-14-2006, 07:04 AM
I have had this same problem, unfortunately if you think about it, it doesn't make sense for it to throw an error. Because a lot of times there might not be any data that matches that xpath at a particular moment and that might be perfectly fine. Maybe it would makes senses to have a mechanizism that you could mark a particular view so that it throws error whenever there is data and that datapath does not match anything. Maybe something like this (untested):
<view name="rowOfData" datapath="myData:profiles/profile">
<method event="ondata" reference="myData">
if(this.datapath.p==null){
Debug.error(this.name+".datapath ("+this.datapath.xpath+") failed to match anything");
}
</method>
maritimesource
03-14-2006, 07:26 AM
Yea, what you are saying makes sense.
However, wouldn't this be invalid:
myData:profiles/profile
Where the slash is missing after the colon? If it is invalid, then that's a case where an error would be useful.
comcrazy
12-20-2007, 06:33 PM
By using init method like below, I found out that the object is created. Then I used the isValid() to check the datapath and set the visible to true if is not valid. The object show.
<method name="init">
<![CDATA[
super.init();
/* Draw the frame */
this.drawframe();
axisdrawview.drawframe();
if (!this.datapath.isValid()) {
this.setVisible(true);
} else {
draw();
}
]]>
</method>
vBulletin® v3.8.4, Copyright ©2000-2012, Jelsoft Enterprises Ltd.