Skip to main content

Download from GitHub and upload of plugin (1 Datasource Table)

  1. Navigate to HSYCO Manager

  2. Click on "File Manager"

  1. Navigate to "plugins" or create this folder if inexistent by clicking "New folder" in the left upper-side of the file manager.

Tip: Now we will download from the GitHub Repository the folder that contains the code and the project.

  1. Navigate to https://github.com/hsyco/hsyco4-examples

  2. Click "Code"

  1. Click "Download ZIP"

  1. Extract the hsyco4-examples.zip and navigate into "/table" to find the folder named "todolisttabledatasource". Make that folder a .zip file.

  2. Click "Upload Files"

  1. Click "Select file" and select from your computer the todolisttabledatasource.zip file that we just created.

  1. Click "Upload"

  1. As you can see, we have just imported the plugin successfully into our /plugin folder in HSYCO.

Tip: Now we have our plugin "todolisttabledatasource" that contains the "events" folder and the "www" folder. Inside this folder there is the "projects" folder, and inside this a folder with the actual name of the project with a .xml file inside that specifies all the pages and object in this project. This method of having the project folder inside the main plugin folder is good if your plugin has associated interfaces. In our case, the project has a table object in a page associated to the code, so it is a good idea to make it as a plugin instead of just having the project folder in the root directory. If you want to make your own plugin, follow this guide on the wiki page: https://wiki.hsyco.com/3.8/index.php/Plugins_Applications You can create the project in the project editor like you would do normally and then move that folder under "/plugins/'ProjectName'/www/projects/"

Tip: Now I'll go in detail about the code

12. The first instruction, in the INIT, is used to retrieve the connection to the database. We store it in the "dbConn" variable and, after that, we set te AutoCommit to true. In this case, when a change in the database is made, it is autocommitted. Then we execute a statement to the database that is used to don't identify null values as unique. This is used to avoid that, if two values are both null, they are treated as a single null. Now we execute the "Create" statement that creates the "todolist" table with an autogenerated id, a date, a time and a 256 char text. If this operation is successful, a message is shown in the log. Lastly, we set the DataSourceSQL for the Project Editor linking "db_todolist" to the table named "todolist" which has "id" as a primary key.

13. In the userCommand function, if the name of the command is "cleardb", which we will se later is a button used to clear all records in the database, execute the statement that does all of this. Then, with the "touch" option, we can "alert" db_todolist that a change in db_todolist has been made. It may seem strange, but it is used to have a real-time change in the table, so that when we press that button, the records are deleted and the table empties in real-time because the database sees the change (even if it changes itself).

-