I'm having some difficultly understanding how to program a
loop that checks whether a string value is TRUE. And if its not
TRUE, I want it to start again until it gets a TRUE response.
So what I mean is - I am reading in a XML file from a
standard URL. I then use <cfset> to put the information into
a variable. However I only want to put it into the variable if an
element called STATUS is "OK". If its not "OK", then I want it to
read more files in until it hits one where the STATUS is "OK".
Heres my code thus far:
<cfhttp url="
http://www.xxx.com?Name=#RandName#&PartNumber=#RandPartNo#">
<cfset xItem = xmlparse(cfhttp.FileContent)>
<cfif #xItem.XXXFeed.product.STATUS.xmltext# IS "OK">
<cfset Item = xItem.HDSFeed.product.item>
So as you can see above, the URL from which the data is
coming from is generated using random names and part numbers. So
each time you refresh the page (using F5), it will return different
information. It then checks to see if the STATUS atttribute
contains text that says "OK". If it is indeed "OK", then we can
create the variable "Item". If the text IS NOT "OK" then I want it
to basically refresh itself until it does retireve a URL which
contains STATUS as "OK".
Any idea how this achieved? The variables #RandName# and
#RandPartNo# are generated from a database query on the same page
of course. Hence the need to refresh the whole page.