PDA

View Full Version : App runs in OL 3.4.0 but not in 4.05


bison
10-10-2007, 07:56 PM
Hi Guys,

I have an app that displays data from an xml on the lzx front end.It runs just fine in 3.4.0. But when I try compiling it in 4.0.5 the app compiles but doesn't show data from the datasets. It loads all the details of the UI though.

I neither get an error nor a warning different from what I used to get in 3.4 for the same app but I do get the following line in blue in the debugger

"INFO :getNodeAttribute : p is null in LzDatapointer" .


What could possibly be the reason ?

Thanks.

hqm
10-11-2007, 06:56 AM
Can you send me the part of code which declares the datasets and the
event handlers?

There has been some confusion because in 3.x, you could declare methods
and handlers on datasets in a manner that has changed

In 3.x if you declared a dataset like this
<dataset name="foo" type="http">
<method event="ondata">
...
</method>
</dataset>

You would get a warning in the compiler but the code would work,
whereas in 4.0.5, you need to add the following attribute to get it to
look at the body of the dataset:

<dataset name="foo" type="http" datafromchild='true'>

or else the compiler ignores the methods or handlers inside the body of the dataset. This is a bug
which will be fixed soon in the nightly releases.

vernid
10-11-2007, 07:54 AM
Hi,

Where I can find the description and the behavior of this 'datafromchild' attribute in the documentation, because I looked a the lps4 Ref guide Dataset and didn't find it?

Regards
Dominique

hqm
10-11-2007, 08:34 AM
I'm curious if this fixed your problem, or is there something else the matter. Can you tell me if you're still seeing the bug with this change to your dataset declarations?


Unfortunately this attribute is not documented yet, as it wasn't officially made a part of the API yet, it was done as a prototype implementation for an internal project. I'll be getting a fix in to make things compatible with 3.x behavior, which will be part of the nightly builds and part of the 4.0.6 release.

bison
10-11-2007, 01:17 PM
Hi Henry,

Thanks for the reply.That doesn't seem to fix the issue,still working on it.I will get back in a few minutes with the code block .Sorry for the delay.

bison
10-11-2007, 01:33 PM
This is what I get in the debugger:

Initialize Canvas
INFO: getNodeAttribute: p is null in LzDatapointer
ERROR @widget1.lzx#79: reference to undefined variable 'defaultLocId'
defaultLocId= undefined
ERROR @widget1.lzx#81: reference to undefined variable 'defaultLocId'
INFO: getNodeAttribute: p is null in LzDatapointer
WARNING @widget1.lzx#83: reference to undefined property 'defaultGenId'
undefined
INFO: getNodeAttribute: p is null in LzDatapointer
ERROR @widget1.lzx#87: reference to undefined variable 'defaultLocId'
Initialize Canvas
defaultLocId= 1
1001

I neither get that error nor that INFO when I run in 3.4.0 though I get the warnings and app runs just fine. Part of the code where the trouble is brewing is below.

<canvas width="1024" height="450" bgcolor="#FFFFFF" debug="true" proxied="true" title="xyz">

<debug x="1" y="250" height="200" width="700" />

<!-- Includes -->
<include href="resources.lzx" />
<include href="classlibrary.lzx" />

<!-- Datasets -->
<!--<dataset name="dsStockMain" src="data/stockresult.xml" />-->
<dataset name="dsStockMain" src="data/stockresult.xml" type="http" request="true" datafromchild='true'/>
<datapointer name="dpStockMain" />

<!--<dataset name="dsStockContainer" src="data/stockresult_default.xml" />-->
<dataset name="dsStockContainer" datafromchild="true">
<result></result>
</dataset>
<datapointer name="dpStockContainer" xpath="dsStockContainer:/result" />

<dataset name="dsLoc" datafromchild="true" />
<datapointer name="dpLoc" xpath="dsLoc:/" />

<!-- Handler -->
<handler name="ondata" reference="dsStockMain">
xyzcontainer.refresh();
</handler>

<!-- Appication Modules -->
<view id="xyzborder" x="3" y="33" width="${xyzcontainer.width+2}" height="${xyzcontainer.height+2}" bgcolor="#333333">

<view id="xyzcontainer" x="1" y="1" width="${widgetwidth}" bgcolor="#FFFFFF" layout="axis: y; inset: 2" font="Verdana">

<!-- Initialization -->
<handler name="oninit">
this.refresh();
</handler>




<!-- Attributes -->
<attribute type="number" name="widgetwidth" value="780" />
<attribute type="number" name="fittingtickerboxes" value="4" />
<attribute type="number" name="chosenTabPosition" value="1" />
<attribute type="number" name="chosenTabLocId" value="1" />

<attribute name="defaultLocId" type="string" value="1" /> <attribute name="defaultGenId" type="string" value="1001" />

<!-- Handlers -->
<handler name="oninit">
//xyzcontainer.scrollercontainer.clipper.holder.tick ermover.doStart();
//Debug.write(xyzcontainer.scrollercontainer.clipper .holder.tickermover);
</handler>

<!-- Major Methods -->

<!-- Method -->
<method name="refresh">

Debug.write("Initialize Canvas");
var dpGen = new LzDatapointer();

// Get Defaults
dpGen.setXPath("dsStockMain:/result/information");
defaultLocId = dpGen.getNodeAttribute("defaultLocId"); Debug.write("defaultLocId=",defaultLocId);

dpGen.setXPath("dsStockMain:/result/locationgroup/location[@locId = '"+ defaultLocId + "']");
this.setAttribute("defaultGenId", dpGen.getNodeAttribute("defaultGenId"))
Debug.write(this.defaultGenId);
defaultGenId = dpGen.getNodeAttribute("defaultGenId");

// Initialize Tabs
dpGen.setXPath("dsStockMain:/result/locationgroup/location[@locId = '"+ defaultLocId + "']");
var count = dpGen.getNodeCount();

// For location
for (var i = 1; i &lt;= count; i++) {
dpStockMain.setXPath("dsStockMain:/result/locationgroup/location[@locId = '"+ defaultLocId + "']/tab["+i+"]");
dpStockContainer.addNodeFromPointer(dpStockMain);
dpLoc.addNodeFromPointer(dpStockMain);
}

</method>



I am not sure why the error that DefaultLocId is undefined comes up in 4.0.5 and not in 3.4.so it just did this to do away with that error

var defaultlocid = .... ;

the above addition of 'var' removed the error but doesnt change anything else.The data still doesnt show up on the front end of the widget.

bison
10-12-2007, 09:27 AM
^pop^pop^pop

notzippy
10-12-2007, 10:12 AM
Try
var valid = dpGen.setXPath("dsStockMain:/result/information");;
if (!valid) return;

z

bison
10-15-2007, 03:14 PM
NotZippy,

Why are we doing that ? I did that and it take away one of the warnings.But when I changed the 'oninit' handler to 'ondata' as suggested in another thread it removed all warnings,and blue INFO line in the debugger though the data doesn't display on the screen still.

notzippy
10-16-2007, 05:26 AM
If you read the manual you will see that Datapointer.setXPath returns:
Boolean|Undefined true if the path matches a single node, false if no or multiple nodes are matched, undefined if the path is invalid.

z