Hello World

This sample creates a Timer service that will, at a predetermined time, automatically create a text file with the content: "Hello World".

To achieve this, our Linx solution will use the File plugin and the Timer service contained in the Utilities plugin.


Download

HelloWorld.zip


To run the sample

  1. Download the sample file (HelloWorld.zip).

  2. Open the HelloWorld solution with Linx Designer.

  3. In the Properties section for the TextFileWrite (HelloWorld) function, note the File path value: C:\temp\HelloWorld\HelloWorld.txt - update this value to a suitable path, or create the C:\temp\HelloWorld\ directory on your machine.

  4. In the Properties section for the Timer service, note the Run at value: "11:45:00" - update this value to a suitable time, or deploy your solution to Linx Server and wait for 11:45 to see the end result.

  5. Debug the HelloWorld process.

  6. Deploy the HelloWorld Solution to Linx Server.

  7. Start the Service.


Creating the sample

The following steps can be used to re-create the solution used in this sample, or to use as a guide when deploying and running the sample:

  1. Create a Solution, Project, and Process with descriptive names.

  2. Add the following Plugins to your Solution:

    • Utilities
    • File
  3. From the File plugin, add the TextFileWrite function to your process, and rename it to HelloWorld.

  4. Click on the TextFileWrite (HelloWorld) function in the main canvas, then enter the following details in the Properties section:

    a. File Path - The full path of the file, in this case "C:\temp\HelloWorld\HelloWorld.txt".

    b. Contents – The text data to write to the file, in this case "Hello World".

    c. File exists – Select "Overwrite file" from the drop-down list.

  5. From the Utilities plugin, add the Timer Service to the Project.

  6. Enter the details of the Properties associated with the Timer Service:

    a. Mode – Select "Specific times" from the drop-down list.

    b. Run at – Enter the time for the service event to run, in this case "11:45:00".

  7. Set up your TimerEvent by doing the following:

    a. Click on TimerEvent in the Solution Explorer section

    b. Drag and drop HelloWorld from the Solution Explorer section onto the main canvas – the effect of this is that, when triggered, TimerEvent will call the HelloWorld function

  8. Debug the process

    For details on how to debug, please go here

  9. Deploy the Solution to Linx Server

    For details on how to deploy your Solution, please go here

  10. Start the Service on Linx Server by doing the following:

    a. Log in to Linx Server

    b. Select the applicable Solution

    c. Click the Start button to start the service

  11. Verify the successful creation of your HelloWorld file

    To check whether your service is executing as expected, do the following:

    a. In the specified directory, check that the HelloWorld.txt file was created at the time the Timer service was supposed to execute, e.g. at 11:45, and that the file's content is "Hello World".

    b. On Linx Server, check that the Event executed successfully