I've been spending the last few weeks trying to write new macros for my web spreadsheet.
Here's the cycle I've been following when I do my new macro development:
1. Create/edit a new macro using Tools -> Macros -> Macro Editor.
2. Create a button in spreadsheet.
3. Add macro to button.
4. Press button.
5. In veritably, macro doesn't work but there is no popup or other indication on spreadsheet that macro failed.
6. Using System Manager -> Logs and 7-9 clicks, get the most recent failures (or better yet, since log messages are truncated) do tail -f logs/core.logs
7. Look for error related to [php_macro_engine] (even though this is a spreadsheet failure). Error looks something like this:
8. Edit the tmp file using vi/emacs and look for line with error in it. In case above error is undefined function, otherwise you'll need to hunt and peck to see why the PHP failed.
9. Correct the error if obvious. If not obvious insert the following statement to get a popup with various variables populated.
10. If macro continues to fail, move return _msgbox() statement around to isolate problem.
I'd like to find out the best way to develop macros because this debug loop is getting pretty tiresome.
I'm also thinking there are at least 3 improvements Jedox could make to make this process better.
1. Add PHP syntax checking when user selects that "save" icon in the PHP editor page. I think the editor does some rudimentary checking but I think validating it against known functions might be better.
2. Add a PHP debug error pane/popup would be nice too. That way the developer doesn't need to pop out to shell or log app to investigate error.
3. Provide context in error dump in logs or error pane. Providing the +-3 line context around the failure would make debugging these issues a lot less painful.
Here's the cycle I've been following when I do my new macro development:
1. Create/edit a new macro using Tools -> Macros -> Macro Editor.
2. Create a button in spreadsheet.
3. Add macro to button.
4. Press button.
5. In veritably, macro doesn't work but there is no popup or other indication on spreadsheet that macro failed.
6. Using System Manager -> Logs and 7-9 clicks, get the most recent failures (or better yet, since log messages are truncated) do tail -f logs/core.logs
7. Look for error related to [php_macro_engine] (even though this is a spreadsheet failure). Error looks something like this:
- [2013/02/25 10:06:56] ERROR [php_macro_engine] PHP Fatal error: Call to undefined function retrive_variable() in /core-Linux-i686/tmp/mmdl_f8a19c5a-46db-4571-a4da-5be82c5c5490.php on line 99
- [2013/02/25 10:06:56] ERROR [php_macro_engine] failed to execute PHP function 'em()' from file '../httpd/app/base/macro/em.php': unable to execute function
8. Edit the tmp file using vi/emacs and look for line with error in it. In case above error is undefined function, otherwise you'll need to hunt and peck to see why the PHP failed.
9. Correct the error if obvious. If not obvious insert the following statement to get a popup with various variables populated.
- return _msgbox("messages $variable1, $variable2.","Debug errors","Info");
10. If macro continues to fail, move return _msgbox() statement around to isolate problem.
I'd like to find out the best way to develop macros because this debug loop is getting pretty tiresome.
I'm also thinking there are at least 3 improvements Jedox could make to make this process better.
1. Add PHP syntax checking when user selects that "save" icon in the PHP editor page. I think the editor does some rudimentary checking but I think validating it against known functions might be better.
2. Add a PHP debug error pane/popup would be nice too. That way the developer doesn't need to pop out to shell or log app to investigate error.
3. Provide context in error dump in logs or error pane. Providing the +-3 line context around the failure would make debugging these issues a lot less painful.