Active TopicsActive Topics  Display List of Forum MembersMemberlist  Search The ForumSearch  HelpHelp
  RegisterRegister  LoginLogin
PowerHome Programming
 PowerHome Messageboard : PowerHome Programming
Subject Topic: 26 forecast globals Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
krommetje
Super User
Super User
Avatar

Joined: December 29 2004
Location: Netherlands
Online Status: Offline
Posts: 695
Posted: January 18 2015 at 05:15 | IP Logged Quote krommetje

Hi all,

I have cumulus still up and running and use realtime.txt to import weatherdata from my own weatherstation. (see http://www.power-home.com/forum/forum_posts.asp?TID=3428&PN= 1)
Now the 49th data item in realtime contains a numeric code which corresponds with a forcast and these 26 fortecasts I have put in 26 globals. Forecast1 through 26.
The global FORECAST contains the numeric code.

I want to subistute the numeric code in a webpage but for some reason my code does not work

Code:

<%if(ph_getglobal_n("FORECAST")=26, ph_getglobal_n("FORECAST26"),if(ph_getglobal_n("FORECAST")=2 5, ph_getglobal_n("FORECAST25"),if(ph_getglobal_n("FORECAST")=2 4, ph_getglobal_n("FORECAST24"),if(ph_getglobal_n("FORECAST")=2 3, ph_getglobal_n("FORECAST23"),if(ph_getglobal_n("FORECAST")=2 2, ph_getglobal_n("FORECAST22"),if(ph_getglobal_n("FORECAST")=2 1, ph_getglobal_n("FORECAST21"),if(ph_getglobal_n("FORECAST")=2 0, ph_getglobal_n("FORECAST20"),if(ph_getglobal_n("FORECAST")=1 9, ph_getglobal_n("FORECAST19"),if(ph_getglobal_n("FORECAST")=1 8, ph_getglobal_n("FORECAST18"),if(ph_getglobal_n("FORECAST")=1 7, ph_getglobal_n("FORECAST17"),if(ph_getglobal_n("FORECAST")=1 6, ph_getglobal_n("FORECAST16"),if(ph_getglobal_n("FORECAST")=1 5, ph_getglobal_n("FORECAST15"),if(ph_getglobal_n("FORECAST")=1 4, ph_getglobal_n("FORECAST14"),if(ph_getglobal_n("FORECAST")=1 3, ph_getglobal_n("FORECAST13"),if(ph_getglobal_n("FORECAST")=1 2, ph_getglobal_n("FORECAST12"),if(ph_getglobal_n("FORECAST")=1 1, ph_getglobal_n("FORECAST11"),if(ph_getglobal_n("FORECAST")=1 0, ph_getglobal_n("FORECAST10"),if(ph_getglobal_n("FORECAST")=9 , ph_getglobal_n("FORECAST9"),if(ph_getglobal_n("FORECAST")=8, ph_getglobal_n("FORECAST8"),if(ph_getglobal_n("FORECAST")=7, ph_getglobal_n("FORECAST7"),if(ph_getglobal_n("FORECAST")=6, ph_getglobal_n("FORECAST6"),if(ph_getglobal_n("FORECAST")=5, ph_getglobal_n("FORECAST5"),if(ph_getglobal_n("FORECAST")=4, ph_getglobal_n("FORECAST4"),if(ph_getglobal_n("FORECAST")=3, ph_getglobal_n("FORECAST3"),if(ph_getglobal_n("FORECAST")=2, ph_getglobal_n("FORECAST2"),if(ph_getglobal_n("FORECAST")=1, ph_getglobal_n("FORECAST1"),0))))))))))))))))))))))))))%>


is the formula too long? What am I doing wrong here?

Edited by krommetje - January 18 2015 at 05:16
Back to Top View krommetje's Profile Search for other posts by krommetje Visit krommetje's Homepage
 
dhoward
Admin Group
Admin Group
Avatar

Joined: June 29 2001
Location: United States
Online Status: Offline
Posts: 4447
Posted: January 18 2015 at 11:10 | IP Logged Quote dhoward

Peter,

Formula was way too long for me to just work completely through it (although PowerHome should have no problems with long formulas) but I think I get the gist of it.

You should be able to simplify it down to this:
Code:
<%ph_getglobal_s("FORECAST" + ph_getglobal_s("FORECAST"))%>


Im thinking the reason why your code isnt working is that when your if condition is true,you're executing a ph_getglobal_n("FORECAST26") which is most likely a string of the forecast. You would need to change all of your ph_getglobal_n("FORECASTXX") functions to ph_getglobal_s("FORECASTXX").

Anyways, try my formula and I think you'll find it works.

Dave.
Back to Top View dhoward's Profile Search for other posts by dhoward Visit dhoward's Homepage
 
krommetje
Super User
Super User
Avatar

Joined: December 29 2004
Location: Netherlands
Online Status: Offline
Posts: 695
Posted: January 18 2015 at 11:57 | IP Logged Quote krommetje

silly me... forgot about the PLUS Sign... Must have been far and away ....
Back to Top View krommetje's Profile Search for other posts by krommetje Visit krommetje's Homepage
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum