Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
WinDev Forum
Beiträge im Thema:
3
Erster Beitrag:
vor 5 Jahren, 2 Monaten
Letzter Beitrag:
vor 5 Jahren, 2 Monaten
Beteiligte Autoren:
Alan Evans, Arie

HADD() in Android

Startbeitrag von Alan Evans am 25.04.2013 14:32

Hi,

I've got a strange problem using HADD() on Android. The process never seems to finish.
See the code posted below, basically it parses through an XML file on the tablet that is the result of a HttpRequest and just adds the info to a table. The file that it is running though is just under 3MB in size. Running the same code over another file that is 64K in size works fine, but here it freezes up. If I take the Hadd() out of the code it runs fine.

Any ideas, it's really annoying !

Many thanks

Alan



HourGlass(True)
sx is boolean=HTTPDestination("/sdcard/prodcost.xml")
cc is boolean=HTTPRequest("http://xx.xx.xx.xx/wbc/service1.asmx/Getprodcost"; ,"")

sMyXMLDoc is string = "XML"
sXMLInfo is string
FOR ALL Consumables_picklist
HDelete(Consumables_picklist)
END

// Load the XML file into a string
sXMLInfo = fLoadText("/sdcard/prodcost.xml")

// Initialize the XML functions on this file
XMLDocument(sMyXMLDoc, sXMLInfo)

// position on the root
XMLRoot(sMyXMLDoc)

// Read while searching for invoices and information
// about these invoices (structure of XML file known)

LOOP

XMLFind(sMyXMLDoc, "FSTOCK", XMLElement + XMLChildItem + XMLContinue, XMLIgnoreCase + XMLExact)
IF XMLFound(sMyXMLDoc) = False THEN BREAK

XMLChild(sMyXMLDoc)

XMLFirst(sMyXMLDoc)

WHILE XMLOut(sMyXMLDoc) = False
SWITCH XMLElementName(sMyXMLDoc)
CASE "STOCKCODE"
Consumables_picklist.partnumber= XMLData(sMyXMLDoc)
CASE "DECSRIPTION"
Consumables_picklist.description= XMLData(sMyXMLDoc)
CASE "STPRICE"
Consumables_picklist.cost= XMLData(sMyXMLDoc)
CASE "STOCK_RRP"
HAdd(Consumables_picklist)
END
XMLNext(sMyXMLDoc)
IF ErrorOccurred THEN
ErrorInfo(errCode)
END
END
END
HourGlass(False)
Info("Finished")

Antworten:

Hi Alan,
your Errorinfo() is outside the XML-loop. I think a better place is before the XMLNext().
Or even better together with HAdd(), which could possibly throw an error. Then you will notice it at that very moment.

IF NOT HAdd() THEN
Error(ErrorInfo())
END

von Arie - am 25.04.2013 17:03
Hi Arie,

Sorry, just back around to reading the forum, so busy !

Yes, I take your point about the Error positioning. What it turned out to be in the end was that the file, at 2.64MB, was just too big for WM to cope with. I put a counter into a Notification bar and watch it read each record. It got to about a halfway point in the file, the counter getting slower and slower as it did so, and then just stopped. Another file at 64KB it was alright with.

I decided then to opt for a dynamic web service which allow the user to search online and that worked fine.

Thanks

Alan

von Alan Evans - am 16.05.2013 10:22
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.