Active TopicsActive Topics  Display List of Forum MembersMemberlist  Search The ForumSearch  HelpHelp
  RegisterRegister  LoginLogin
PowerHome Bug Reports
 PowerHome Messageboard : PowerHome Bug Reports
Subject Topic: Macro Import/Export Problem - Bug? Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
Dean
Senior Member
Senior Member
Avatar

Joined: August 21 2003
Location: United States
Online Status: Offline
Posts: 109
Posted: December 02 2006 at 23:11 | IP Logged Quote Dean

Dave,

I'm having a problem importing macros. This started with trying to import Tony's weather macro. I get the following when trying to import the macro:

Invalid Direct SQL Code -207
     SQLSTATE = 21S01
[Sybase][ODBC Driver][Adaptive Server Anywhere]Insert value list does not match column list: Wrong number of values for INSERT

I made sure the macro name didn't already exist.

Since I couldn't import the weather macro, I exported an existing macro, changed the macro name, then tried to import it. Same problem.

I also have problems deleting macros. If I bring up PH Explorer, click on macros, then right-click on a macro name in the right window pane and click delete, many times it does not delete. I mean it shows it deleted in the right pane of PH Explorer, but if I click on Macros again in the left pane of PH Explorer, it shows up again. If I reinitialize PH, then delete the macro, it seems to stay deleted. I'm not sure if something funny happens during the failed import which cause the delete to have problems, then reinitializing fixes it or what.

Since I'm talking Macros, I also find it strange that if I right-click on a macro name in the left window pane of PH Explorer, the left pane collapses/shrinks. I have to resize the left window pane of PH Explorer to see it again.

-Dean
Back to Top View Dean's Profile Search for other posts by Dean
 
TonyNo
Moderator Group
Moderator Group
Avatar

Joined: December 05 2001
Location: United States
Online Status: Offline
Posts: 2889
Posted: December 03 2006 at 09:57 | IP Logged Quote TonyNo

Dean, that error means a version problem: The macro came from a different one since the columns are different.

Wait, I just read on and saw that you can't import what you export! I'll try this on my end and report back.

The right-click means expand the right pane to max. Takes some getting use to!
Back to Top View TonyNo's Profile Search for other posts by TonyNo Visit TonyNo's Homepage
 
TonyNo
Moderator Group
Moderator Group
Avatar

Joined: December 05 2001
Location: United States
Online Status: Offline
Posts: 2889
Posted: December 03 2006 at 10:23 | IP Logged Quote TonyNo

OK, I checked this and import/export works. Maybe the failed import/export tipped the scales.
Back to Top View TonyNo's Profile Search for other posts by TonyNo Visit TonyNo's Homepage
 
dhoward
Admin Group
Admin Group
Avatar

Joined: June 29 2001
Location: United States
Online Status: Offline
Posts: 4447
Posted: December 07 2006 at 13:11 | IP Logged Quote dhoward

Dean,

Got your email and your DB checks out fine. The problem with the GETWEATHER macro you were trying to import is that the table structure changed slightly between the exported macro and the database you now have. To get the GETWEATHER macro working properly, you need to add an extra empty string parameter to the end of each macrodetail line.

I did this by opening the SQL in the multi-editor and using a find/replace (Control-H) with a find value of: ); and a replace value of: ,'');

This adds the extra empty string parameter that the new database structure requires. I also had to go to the first line (the macroheader) line and delete this extra parameter that was just added since the macroheader table structure did not change. Anyways, Ive posted the corrected SQL which should work for PowerHome 1.03.4.9 below:

Code:

insert into macroheader values ('GET WEATHER','GET WEATHER',0,1,1);
insert into macrodetail values ('GET WEATHER',2,15,'[LOCAL1] ',NULL,'mid(ph_geturl("www.wunderground.com/cgi-bin/findweat her/getForecast?query=07747"),20000,30000)',0,'');
insert into macrodetail values ('GET WEATHER',4,15,'[LOCAL3]',NULL,'pos("[LOCAL1]","</b>",[LOCAL2])',0,'');
insert into macrodetail values ('GET WEATHER',6,15,'[LOCAL4]',NULL,'"The temperature is " + if(isnumber("[LOCAL3]"),"[LOCAL3]",left("[LOCAL3]",2)) + " degrees, "',0,'');
insert into macrodetail values ('GET WEATHER',8,15,'[LOCAL2]',NULL,'pos("[LOCAL1]","<nobr><b>",pos("[LOCAL1]","Windchill:</td>")) + 9',0,'');
insert into macrodetail values ('GET WEATHER',10,15,'[LOCAL3]',NULL,'mid("[LOCAL1]",[LOCAL2],[LOCAL3] - [LOCAL2])',0,'');
insert into macrodetail values ('GET WEATHER',12,15,'[LOCAL2]',NULL,'pos("[LOCAL1]","<b>",pos("[LOCAL1]","Humidity:</td>",[LOCAL2])) + 3',0,'');
insert into macrodetail values ('GET WEATHER',14,15,'[LOCAL4]',NULL,'"[LOCAL4]" + " and the humidity is " + if(isnumber("[LOCAL3]"),"[LOCAL3]",left("[LOCAL3]",2)) + " percent. "',0,'');
insert into macrodetail values ('GET WEATHER',16,37,'',NULL,'',0,'');
insert into macrodetail values ('GET WEATHER',18,15,'[LOCAL2]',NULL,'pos("[LOCAL1]",''<td align=left width="100%" >'') + 32',0,'');
insert into macrodetail values ('GET WEATHER',20,15,'[LOCAL4]',NULL,'"The forecast for " + mid("[LOCAL1]",[LOCAL2],[LOCAL3] - [LOCAL2] ) + " is "',0,'');
insert into macrodetail values ('GET WEATHER',22,15,'[LOCAL3]',NULL,'pos("[LOCAL1]","<br>",[LOCAL2])',0,'');
insert into macrodetail values ('GET WEATHER',24,15,'[LOCAL4]',NULL,'ph_replaceall("[LOCAL4]","...",". " )',0,'');
insert into macrodetail values ('GET WEATHER',1,16,'',NULL,'if({INTERNET FLAG}=0,999,1)',0,'');
insert into macrodetail values ('GET WEATHER',3,15,'[LOCAL2]',NULL,'pos("[LOCAL1]","<b>",pos("[LOCAL1]","<font size=+2 face=arial><b>") + 28) + 3',0,'');
insert into macrodetail values ('GET WEATHER',5,15,'[LOCAL3]',NULL,'mid("[LOCAL1]",[LOCAL2],[LOCAL3] - [LOCAL2])',0,'');
insert into macrodetail values ('GET WEATHER',7,16,'',NULL,'if(pos("[LOCAL1]","Windchill") = 0, 5, 1)',0,'');
insert into macrodetail values ('GET WEATHER',9,15,'[LOCAL3]',NULL,'pos("[LOCAL1]","</b>",[LOCAL2])',0,'');
insert into macrodetail values ('GET WEATHER',11,15,'[LOCAL4]',NULL,'"[LOCAL4]" + "with a windchill of " + if(isnumber("[LOCAL3]"),"[LOCAL3]",left("[LOCAL3]",2)) + ", "',0,'');
insert into macrodetail values ('GET WEATHER',13,15,'[LOCAL3]',NULL,'mid("[LOCAL1]",[LOCAL2],3)',0,'');
insert into macrodetail values ('GET WEATHER',15,10,'TEMP STR',NULL,'"[LOCAL4]"',0,'');
insert into macrodetail values ('GET WEATHER',17,15,'[LOCAL1] ',NULL,'mid(ph_geturl("www.wunderground.com/cgi-bin/findweat her/getForecast?query=07747"),50000,30000)',0,'');
insert into macrodetail values ('GET WEATHER',19,15,'[LOCAL3]',NULL,'pos("[LOCAL1]","</b>",[LOCAL2])',0,'');
insert into macrodetail values ('GET WEATHER',21,15,'[LOCAL2]',NULL,'[LOCAL3] + 9',0,'');
insert into macrodetail values ('GET WEATHER',23,15,'[LOCAL4]',NULL,'"[LOCAL4]" + mid("[LOCAL1]",[LOCAL2],[LOCAL3] - [LOCAL2])',0,'');
insert into macrodetail values ('GET WEATHER',25,10,'WEATHER STR',NULL,'"[LOCAL4]"',0,'');


I tried to duplicate the behaviour with macro deleting and could not get it to do as you described. The failed macro import shouldnt have any effect on this but at this point I can offer no other explanation. If I right click a macro and hit delete, it disappears from the right hand window but still appears in the left hand tree. At this point, the macro is not truly deleted until the changes are saved. The changes will be saved automatically if I exit the Explorer or change the right hand window to a different window or explicitly save by hitting the "F5" key. When I do this, then the left hand tree is updated to show that the macro is deleted.

Yep, it's strange . Right-clicking in the tree view just minimizes it to expand the detail view. If you were to right-click the tree view again, it will expand back out to it's default size.

Dave.
Back to Top View dhoward's Profile Search for other posts by dhoward Visit dhoward's Homepage
 
dhoward
Admin Group
Admin Group
Avatar

Joined: June 29 2001
Location: United States
Online Status: Offline
Posts: 4447
Posted: December 07 2006 at 13:13 | IP Logged Quote dhoward

Oops, forgot to mention...

I think that this version of the GETWEATHER macro is a little dated. I didnt take the time to look, but if memory serves, there are more recent versions of this floating around in the forum that make use of the newer ph_regex functions.

Dave.
Back to Top View dhoward's Profile Search for other posts by dhoward Visit dhoward's Homepage
 
Dean
Senior Member
Senior Member
Avatar

Joined: August 21 2003
Location: United States
Online Status: Offline
Posts: 109
Posted: December 11 2006 at 23:50 | IP Logged Quote Dean

Thanks for the info Dave. I managed to find what I think is the latest get weather macro. It imported fine.

The delete problem is interesting. Trying the three methods to delete the macro didn't work at first, I had to keep trying a bunch of times to get it to delete. It seemed to be specific to that particular macro that failed to import. When I created other macros I could delete them without a problem.

Just a suggestion, but I think it would be nice if there was an upload section on the board so the more experienced Powerhome users could upload macros, or other Powerhome related items that the less-experienced Powerhome users could use/benefit from. It would make it easier to find the latest version of the get weather macro, for example. I know you have to pay fees to host the website and additional bandwidth charges may not be something you want to foot the bill for, but I thought I would throw the suggestion out there anyway.

-Dean
Back to Top View Dean's Profile Search for other posts by Dean
 
smarty
Super User
Super User
Avatar

Joined: May 21 2006
Location: United States
Online Status: Offline
Posts: 728
Posted: December 29 2006 at 16:56 | IP Logged Quote smarty

I also have experienced this macro deletion issue (damn macro does not want to stay deleted).

I found that I had to add a bogus line or two to the macro and then try to delete it. If that didn't work, I changed the macro name and then deleted the new name.

These two items seemed to work. Odd.

__________________
Elk - Insteon - BlueIris - DMC1 - PowerHome - XLobby - HA_Bridge w/Dots - Brultech
Back to Top View smarty's Profile Search for other posts by smarty
 
jostim
Groupie
Groupie
Avatar

Joined: February 12 2007
Location: United States
Online Status: Offline
Posts: 45
Posted: February 14 2007 at 17:11 | IP Logged Quote jostim

I am very new to PH, so I am afraid this may be a stupid question

Dean mentioned in his initial message that he cannot import any macros. Not even a macro he exported himself.
I have the same problem. I tried importing an older and a newer version of the 'GET WEATHER" macro, and tried exporting and importing several of my own macros.
The message I get is:
"Formula Evaluation
    The formula evaluates to:!"

What am I doing wrong?
thanks

- jos



__________________
- jos
Back to Top View jostim's Profile Search for other posts by jostim
 
TonyNo
Moderator Group
Moderator Group
Avatar

Joined: December 05 2001
Location: United States
Online Status: Offline
Posts: 2889
Posted: February 14 2007 at 19:34 | IP Logged Quote TonyNo

Welcome jos!

I'm assuming that you're running the latest PH (1.03.4.9).

This is likely due to needing to create the Global Variables before importing (CURTEMP, CURWINDCHILL, CURHUMIDITY, and CURFORECAST). Did you do that?

If that's not it, which line gives the error?

Edited by TonyNo - February 14 2007 at 19:38
Back to Top View TonyNo's Profile Search for other posts by TonyNo Visit TonyNo's Homepage
 
jostim
Groupie
Groupie
Avatar

Joined: February 12 2007
Location: United States
Online Status: Offline
Posts: 45
Posted: February 15 2007 at 12:51 | IP Logged Quote jostim

Tony,

thanks for your suggestion.
I did create the Global variables. I even tried exporting and importing a super-simple macro without variables.

insert into macroheader values ('DUSK_ON','DUSK FROM OUTSIDE FLOOD',3,0,1);
insert into macrodetail values ('DUSK_ON',1,32,'LR CHANDELIER',17,'55',0,'');
insert into macrodetail values ('DUSK_ON',2,32,'1ST FLOOR HALL',17,'85',0,'');

When I import any macro I get the message:
"Formula Evaluation
    The formula evaluates to:!"

What gives?

- jos

__________________
- jos
Back to Top View jostim's Profile Search for other posts by jostim
 
jostim
Groupie
Groupie
Avatar

Joined: February 12 2007
Location: United States
Online Status: Offline
Posts: 45
Posted: February 15 2007 at 12:52 | IP Logged Quote jostim

Oops,
I forgot to mention that I am running the latest version of PH (1.03.4.9), database version: 1.03.9.3



__________________
- jos
Back to Top View jostim's Profile Search for other posts by jostim
 
dhoward
Admin Group
Admin Group
Avatar

Joined: June 29 2001
Location: United States
Online Status: Offline
Posts: 4447
Posted: February 15 2007 at 12:58 | IP Logged Quote dhoward

Jos,

Welcome to PowerHome. No question is stupid (unless I say it is ).

Your problem however has a very simple solution. Based upon your error message, you have the PowerHome Multi-Editor in PH Formula mode (check the title of the multi-editor to easily see the mode). This is for evaluating PowerHome formulas and the like. To run SQL statements, you need to change the editor to (SQL) mode. A Shift-F5 should do this for you (you can also go to the menu under Edit|Language|SQL to do this as well). This should allow you to execute the SQL and successfully import your macro or other macros.

When importing macros or other SQL elements, just be certain that they don't already exist in your database or you'll be getting a different type of error.

Hope this helps and let us know if you have any other questions or problems.

Dave.
Back to Top View dhoward's Profile Search for other posts by dhoward Visit dhoward's Homepage
 
jostim
Groupie
Groupie
Avatar

Joined: February 12 2007
Location: United States
Online Status: Offline
Posts: 45
Posted: February 15 2007 at 14:06 | IP Logged Quote jostim

Thanks Dave,

I knew it had to be something simple.
it works fine now.

thanks

__________________
- jos
Back to Top View jostim's Profile Search for other posts by jostim
 

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