cgiHTML is an automatically generated Global variable. While it’s probably good practice to declare it at some point, the fact that you’ve declared it as a local is a clear conflict.
As you noted, you’ve used the example in the Help file. It’s wrong on that point.
But in running it with cgiHTML as a Global, I got the same error that you did using:
Global cgiHTML
HTMLDataTable cgiHTML
DisplayData cgiHTML
The table is generated, as are the field titles, but no data was included. This is true when I specify the fields too.
The htmldatatable statement is intended for use in a web procedure, and is designed to be paired with the webselect statement. If you don’t use webselexct before the htmldatatable statement, it thinks that no records are selected and you get the results you describe. In other words, this is a feature, not a bug.
For your experiment you are clearly using htmldatatable on a “regular” (non-server) copy of Panorama. It seems you might be the first person to ever do that, but I can certainly imagine situations where that could be useful. In light of that, I have just changed the htmldatatable statement so that when it is run in a non-server environment, it works with regular database selection, instead of requiring that webselect be used. That won’t help you until the next version is released, but maybe it will help someone down the line.
cgiHTML is an automatically generated Global variable. While it’s probably good practice to declare it at some point, the fact that you’ve declared it as a local is a clear conflict.
It’s actually not a conflict in this context, because he isn’t running this code on the server. Still, I agree that using this particular variable name is probably not a great idea, in case this code ever does happen to run on a server.
probably good practice to declare it at some point
I disagree on this - I wouldn’t declare cgiHTML yourself. It you’re running web code, it will always be declared for you. Theoretically it doesn’t hurt to declare it twice, but it doesn’t help either, and who knows if you might ever run this code in some context where it could be a problem. An extra line of code that does nothing is an extra opportunity for a possible problem somewhere in the future.