I am pulling info from zillow and then setting a price based on sq ft of the house. I am also using zillow to pull lat and lon to pull up a google map on the property the problem in some homes don't have sq footage and my cold fusion is returning an error cause it needs a variable this is my xml code to pull the data from zillow.
It's failing at QuerySetCell(xmlqry,"zlot",xmlfile.searchresults.response.results.result[a].lotSizeSqFt.xmlText,a);
cause some property's don't have this info can I check to see if this info is there first then continue.
If it is not there can I set the variable myself it can be 0 or nothing.
<CFHTTP url="http://www.zillow.com/webservice/GetDeepSearchResults.htm?zws-id=X1-<ZSID>&cmd=locate&address=#form.vcAddress1#&citystatezip=#form.vcCity#+#form.numZip#" method="get">
<cfset xmlDoc = XMLParse(cfhttp.filecontent)>
<cfset code = #xmlDoc.searchresults.message.text#>
<cfif #code# contains "successfully">
<cfscript>
xmlfile = xmlparse(cfhttp.filecontent); //Parses the XML
xmlsize = arraylen(xmlfile.searchresults); //Tutorials is the parent tree
xmlqry = QueryNew("zlot, zcode, url, author, platform, descr"); //Sets a query for output
QueryAddRow(xmlqry,xmlsize);
for(a=1;a LTE xmlsize;a=a+1) {
QuerySetCell(xmlqry,"zlot",xmlfile.searchresults.response.results.result[a].lotSizeSqFt.xmlText,a);
QuerySetCell(xmlqry,"zcode",xmlfile.searchresults.message[a].text.xmlText,a);
}
</cfscript>
<cfquery name="GetSqFt" dbtype="query">
SELECT *
FROM xmlqry
ORDER BY zlot DESC
</cfquery>