Div and Mod with Variables

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

CElwell
Posts: 38
Joined: Thu Feb 04, 2016 6:29 pm

Re: Div and Mod with Variables

Post by CElwell » Fri May 06, 2016 12:52 am

That is the ending to the overall node. Therefore, I think that it does not seem to end with the last node, but stops after finding an error possibly?

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10305
Joined: Wed May 06, 2009 2:28 pm

Re: Div and Mod with Variables

Post by dunbarx » Fri May 06, 2016 5:24 am

Well, it seems that the issue is with that last (#369) node. If you add the line:

Code: Select all

if x = 369 then exit repeat
the handler completes without issue.

So it is not a LC issue, I think, per se. It will be interesting to see if anyone can figure out why that last node breaks the otherwise even flow of data and processing.

Oh, and don't give up on "div". With its counterpart, "mod", you can do so much.

Craig

paul_gr
Posts: 319
Joined: Fri Dec 08, 2006 7:38 pm

Re: Div and Mod with Variables

Post by paul_gr » Fri May 06, 2016 10:25 am

xmlparse3.zip
(1.43 KiB) Downloaded 216 times
Run the attached example then scroll to the bottom of the text box.

the list items follow in numerical order the ID's of each animal.

Last legal output from set has ID of 31520691, which is the last and largest number in the data set.

ID: 31520691
Species: Dog
Sex: Female
Breed: Chihuahua, Short Coat / Mix
Age: 0 years 6 months
animal 373

The next ID gives an error: "ID: xmlerr, can't find element"
Species, Sex, Breed, Age all fail as the ID value contains a non numerical value.

This might be relevant::
The number of nodes is 369 according to Livecodes revXMLChildNames() function, but <xmlnode> occurs only 341 times in the .XML file, so I'm assuming there are only 341 animals in the dataset.
I added a counter to the output...--it adds up to 373 animals before the error occurs.
If someone explains this to me I will be grateful :-)

Paul

CElwell
Posts: 38
Joined: Thu Feb 04, 2016 6:29 pm

Re: Div and Mod with Variables

Post by CElwell » Fri May 06, 2016 3:00 pm

Yes I understand there is still an error, which I believe has to do with the last node which looks like this "<XmlNode xsi:nil="true"/>".

Using the "if" does solve the main problem though so that may be the best solution so far.

On the number of nodes:
There are 373 nodes and 373 animals. I am not sure where you are getting these other numbers, but in the xml there are 746 total "XmlNode" (which is divided by 2 as the node has a closing and ending bracket).

Post Reply