PDA

View Full Version : URGENT: problem with selectNext()


red-arrow
09-24-2005, 05:32 AM
HI! I have this kind of dataset:

<record qty="5" total"3.66">
<sku> 2 </sku>
</record>

<record qty="4" total"3.66">
<sku> 3 </sku>
</record>

I don't know prevously how many record nodes I have.
I wanna write every single record (with other information) in a different row of my sql database.
I tried this:

<datapointer id="basket1" xpath="basketDset:/record[1]" />

<button align="left" text="si" y="45" >

<method event="onclick">

do {

var d=canvas.datasets.dett_ordine;
var p=new LzParam();
p.addValue("id_ordine", id_o.getText(), true);
p.addValue("qty", basket1.xpathQuery('@qty'), true);
p.addValue("total", basket1.xpathQuery('@total'), true);
p.addValue("sku", basket1.xpathQuery('sku/text()'), true);

d.setQueryString(p);
d.doRequest();

} while (basket1.selectNext());
</method>
</button>

It seems working fine but it writes me only 2 record... while?
Thanks Andrea

bfagan
09-24-2005, 01:20 PM
First, I'd check to see if your loop is cycling through all items. Throw in a debug.write() to do this;

Second, have you tried queuerequests="true" on your dataset? This should make sure all requests get processed.

red-arrow
09-24-2005, 03:47 PM
Thanks for your answer!

I set the debug.write and if I have 3 nodes it writes "hello" 3 times but on my sql database there are only two rows...
I don't understand...

bfagan
09-24-2005, 08:00 PM
Did you try the second suggestion? Is queuerequests="true" set on your dataset?

red-arrow
09-25-2005, 05:18 AM
Thank you very much!!! Now it works!!!