Page 1 of 1
If Statement Question
Posted: Fri Feb 26, 2010 5:49 pm
by gpearson
After a productive day yesterday learning about connecting RR to WebService, I have created my first application that talks to Adobe Coldfusion Backend. My one questions is on an if/then statement I am needing to compare 2 variables and if they match then perform a specific section of code. My code is listed below
Code: Select all
if tHeatIndexStringField = "NA" and tWindChillString = "NA" then
put "" into field "Feels Like Label"
put "" into field "Feels Like Field"
else if tHeatIndexStringField = "NA" then
put "Wind Chill: " into field "Feels Like Label"
put tWindChillStringField into field "Feels Like Field"
else if tWindChillStringField = "NA" then
put "Heat Index: " into field "Feels Like Label"
put tHeatIndexStringField into field "Feels Like Field"
end if
In my example of Beverly Hills, CA it returns NA for both tHeatIndexStringField and tWindChillStringField in the xml file. When I run my application I am getting the Wind Chill Information to be displayed. What can I do to check these two variables so that in this case the two fields will be blank on the screen.
Re: If Statement Question
Posted: Fri Feb 26, 2010 7:15 pm
by mwieder
What you wrote *should* work, but looks a bit cumbersome. Are you sure the variables don't contain leading or trailing spaces?
You might try something like
Code: Select all
put "" into field "Feels Like Label"
put "" into field "Feels Like Field"
if "NA" is not in tHeatIndexStringField then
put "Heat Index: " into field "Feels Like Label"
put tHeatIndexStringField into field "Feels Like Field"
else if "NA" is not in tWindChillStringField then
put "Wind Chill: " into field "Feels Like Label"
put tWindChillStringField into field "Feels Like Field"
end if
Re: If Statement Question
Posted: Fri Feb 26, 2010 7:35 pm
by gpearson
Thank you for your insight as the modified code worked. Now to work on a timer that updates the display every so many minutes and figure out how to put an icon on windows instead of the white box.
Re: If Statement Question
Posted: Fri Feb 26, 2010 7:51 pm
by mwieder
gpearson wrote:Thank you for your insight as the modified code worked. Now to work on a timer that updates the display every so many minutes and figure out how to put an icon on windows instead of the white box.
send "UpdateTheDisplay" to me in 300 seconds
on UpdateTheDisplay
-- do something here, eh?
end UpdateTheDisplay
"the white box"?
Re: If Statement Question
Posted: Fri Feb 26, 2010 7:58 pm
by gpearson
The White Box is when i create a standalone windows application and run it. The display for the program when the application is running or minimzed on the taskbar. Sorry if I was not clear.
Re: If Statement Question
Posted: Sat Mar 20, 2010 8:37 pm
by markosborne
Graham,
Glad to hear you got it working.
Could you please post your solution for talking to ColdFusion using Revolution? Perhaps with some code or a sample?
Thanks in advance
Mark
Re: If Statement Question
Posted: Mon Mar 22, 2010 12:49 pm
by gpearson
markosborne wrote:Graham,
Glad to hear you got it working.
Could you please post your solution for talking to ColdFusion using Revolution? Perhaps with some code or a sample?
Thanks in advance
Mark
In my application that I am working for We Are Closed Today and on our primary website at
http://www.niesc.k12.in.us, I have one coldfusion page located in /properties/webservice/index.cfm that I use <cfswitch>.....</cfswitch> to process a Method URL Variable. An Example of the Runtime Rev code is
Code: Select all
put url ("http://" & gWebServerService & "/properties/webservices/index.cfm?Method=QueryWUndergroundStations&ZipCode=" & passZipCode) into tWUndergroundStationsData
Which gets translated into
http://demo.weareclosedtoday.com/proper ... Code=46545 This page would return the following XML Code
Code: Select all
<?xml version="1.0" encoding="UTF-8" ?>
- <RunRevXML>
<Credit>We Are Closed Today Website Service</Credit>
<Credit_URL>http://www.weareclosedtoday.com</Credit_URL>
<Description>We Are Closed Today XML Feed of Organizations Current Status to be displayed on website</Description>
<LocationZip>46545</LocationZip>
<LocationCity>Mishawaka</LocationCity>
<LocationState>IN</LocationState>
<LocationCountry>US</LocationCountry>
<LocationTimeZone>EDT</LocationTimeZone>
<ClosestAirportCode>KSBN</ClosestAirportCode>
<ClosestPersonalWSCode>KINMISHA5</ClosestPersonalWSCode>
<CurrentRadarImageURL>46545</CurrentRadarImageURL>
</RunRevXML>
I then use the following code in Runtime Revolution to parse this xml packet and store the information into variables that I can use at other locations in this applet.
Code: Select all
put revCreateXMLTree(tWUndergroundStationsData, false, true, false) into tWUndergroundStationsTreeID
if tWUndergroundStationsTreeID is not a number then
answer error "Error Processing the request or unable to get the information from the Internet. Possible cause would be not connected to the Internet."
exit GetWeatherCodes
end if
put revXMLRootNode(tWUndergroundStationsTreeID) into tWUndergroundStationsXMLRootNode
put revXMLNumberOfChildren(tWUndergroundStationsTreeID, tWUndergroundStationsXMLRootNode, "", 0) into tWUndergroundStationsXMLChildrenNodes
put revXMLNodeContents(tWUndergroundStationsTreeID, "RunRevXML/ClosestAirportCode") into gClosestAirportCode
put revXMLNodeContents(tWUndergroundStationsTreeID, "RunRevXML/ClosestPersonalWSCode") into gClosestPersonalWSCode
put revXMLNodeContents(tWundergroundStationsTreeID, "RunRevXML/NWSRadarID") into gNWSRadarID
put revXMLNodeContents(tWundergroundStationsTreeID, "RunRevXML/WeatherCamera") into gWeatherCam
if revXMLTrees() is not empty then
revDeleteAllXMLTrees
end if
All of the Runtime Revolution applications call the same Coldfusion Page with a different Method variable so I can make an attempt to clean up the website directory structure and have all webservices type of things in one place. If anyone is using Coldfuision as their Application Server and needs specific answers please let me know as my contact information is on the We Are Closed Today Site and I would be more than willing to answer any questions and hope that as I learn more about runtime revolution I would be able to answer questions just like others have done for me.