Active TopicsActive Topics  Display List of Forum MembersMemberlist  Search The ForumSearch  HelpHelp
  RegisterRegister  LoginLogin
PowerHome General
 PowerHome Messageboard : PowerHome General
Subject Topic: ’case’ statement formatting Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
edtude
Groupie
Groupie
Avatar

Joined: July 26 2006
Location: United States
Online Status: Offline
Posts: 64
Posted: June 04 2013 at 22:23 | IP Logged Quote edtude

I am working on some Macros for my Tstat setup and using some of Gadget Guys work as a basis. however this one line I can not get to work and it is a 'case' statement and when I run the macro I get a syntax error. Can anybody tell me where I am making my mistake?

case([LOCAL4]WHEN 0 THEN "Off" WHEN 1 THEN "Heat" WHEN 2 THEN "Cool" WHEN 3 THEN "Auto" WHEN 4 THEN "Fan" )
Back to Top View edtude's Profile Search for other posts by edtude
 
JaredM
Newbie
Newbie


Joined: November 04 2007
Online Status: Offline
Posts: 36
Posted: June 04 2013 at 23:29 | IP Logged Quote JaredM

One guess is that when you're testing it [LOCAL4] is not a number, so your getting a syntax error trying to compare a string to an integer. Try this:

Code:
case(integer('[LOCAL4]') WHEN 0 THEN "Off" WHEN 1 THEN "Heat" WHEN 2 THEN "Cool" WHEN 3 THEN "Auto" WHEN 4 THEN "Fan")
Back to Top View JaredM's Profile Search for other posts by JaredM
 
edtude
Groupie
Groupie
Avatar

Joined: July 26 2006
Location: United States
Online Status: Offline
Posts: 64
Posted: June 10 2013 at 15:25 | IP Logged Quote edtude

I needed to re-init the application and then the 'case' statement worked as expected.
Back to Top View edtude's Profile Search for other posts by edtude
 

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