I have captured and displayed sucessfully the
text data from weather.com. Problem is when there isnt a swa (Severe Weather Alert) the xml tag in the data feed is not present and I get the following error in my prontoscript.
ProntoScript error: TypeError: weather.swa.a[0] has no properties
I assume an if statement could test whether there is data or not but am a bit stumped as to how to test. Any suggestions out there? Below is the snippet of code that is causing the problem.
// Display Severe Weather Alert
try {
var swa = weather.swa.a[0].t;
}
catch (e) {
var swa = "";
}
CF.widget("SWA").label = swa;
System.print("Severe Weather Alert: " +swa);
Thanks in advance...
Last edited by pjjameso on June 24, 2010 13:52.