HelloLinx sample solution

The HelloLinx sample solution is pre-loaded on your Linx Application Server. The following is included in the sample environment:

  • The HelloLinx solution that is already deployed to Linx Application Server.

  • A SQLite database, with a Greetings table that contains 2 columns: Name and Greeting.

  • A folder called hellolinx, with the following sub-folders:

    • import
    • archive
    • samples (containing sample text files that can be used when running the solution)


What does the sample solution do?

The HelloLinx solution has a timer event that executes at 1 minute intervals (configurable) to check in the hellolinx import folder for the existence of text files.

If a text file exists, a new record is written to the Greetings table of your database, with the file name (without the .txt file extension) inserted into the Name column of the table and the file's content inserted into the Greeting column.

Note:

  • The idea is to add a text file that has a person's name as the file name (e.g. John.txt) and with a greeting as the file content, e.g. "Hi There!". There are a few sample files in the samples folder of your F-drive.

The text file is then automatically moved from the import directory to the archive directory.

The solution also has a REST web service with 2 paths (operations):

  • /hello/{name} - This operation checks in the Greetings table for a record of the name provided in the web service- URL. (Existence of the database record is dependent on the Timer event already having found a file with a file name of the same value as the name provided in the URL, and successfully writing the record to the database, as explained above.) If the database record is found, the associated greeting is displayed in the browser.

  • /joke - This operation calls an API (http://api.icndb.com/jokes/random) that returns a random joke. The joke is then displayed in the browser.


What can I do with the sample solution?

  • Run it.
  • Download it.
  • View the Solution in Linx Application Designer.
  • Edit the Solution in Linx Application Designer and re-deploy it to your Linx Application Server to run again. This could involve extending the solution to include more functionality. See some suggestions for extending the sample solution.
  • Remove it from Linx Application Server.


Run the sample solution

Steps:

  1. Click the HelloLinx solution.

  2. Click Settings (menu on the left).

  3. Edit the following settings:
    • TimerInterval (optional): The current setting is 00:01:00, which means that the associated timer event will execute every minute.
  4. Place a .txt file with a person's name as file name (e.g. John.txt) in this folder on your server: f:/mydrive/hellolinx/import/. The content of the file should be any greeting, e.g. "Hi there!"

  5. Wait for the Timer event to execute. (This depends on the value of the TimerInterval setting - step 3, above.)

  6. To run the Hello web service operation, enter the following URL in a your browser: https://[abc].linx.twenty57.net:8081/hello/John (Result: A greeting is displayed in the browser.)

  7. To run the Joke web service operation, enter the following URL in your browser: https://[abc].linx.twenty57.net:8081/joke (Result: A joke is displayed in the browser.)


Demo video: Run HelloLinx


Go here for details on how HelloLinx was created in Linx Application Designer.


Download

HelloLinx


Extend your HelloLinx sample solution

Here are some suggestions on how to further extend your HelloLinx solution:


Create a daily Greetings report

(These steps are performed in Linx Application Designer.)

  1. Add a Timer service from the Utilities plugin.

  2. Edit the Timer properties to indicate when you want the report to run.

  3. Add a Process to your Solution (rename it CreateReport).

  4. Add the TextFileWrite function to your CreateReport process.
    • Rename the function to FileHeaders
    • For the Content property, add this:   ="Name" + "," + "Greeting" + $.System.NewLine
    • For the File does not exist property, select 'Create File'
    • For the File exists property, select 'Increment file name'
  5. Add the ExecuteSQL function to your CreateReport process.
    • Connection type: ODBC
    • Connection string: Driver={SQLite3 ODBC Driver};Database=F:\mydrive\hellolinx\greetings.sqlite3;
    • SQL: SELECT Name, Greeting FROM Greetings;
    • Return options: Row by row
  6. Add the TextFileWrite function to your CreateReport process, nested under the ExecuteSQL function (ForEachRow).
    • File path: =FileHeaders
    • Contents: =ExecuteSQL.ForEachRow.Name + "," + ExecuteSQL.ForEachRow.Greeting + $.System.NewLine
    • File does not exist: Create file
    • File exists: Append data
  7. Click on the TimerEvent in the Solution Explorer section, then drag and drop the CreateReport process onto the main canvas.
  8. Deploy your solution to Linx Application Server.


For help on how to work with services, go here.


Send the daily report via email

  1. Add the Email plugin to your Solution.
  2. From the Email plugin, add the SendEmail function to your CreateReport process.
  3. Add the relevant property values for your sender email account - i.e. Username, Password, From, Port, SMTP server, then add the email address of your receiver (To), and for the Attachment, select 'FileHeaders', which is the CSV report file.
  4. Deploy your solution to Linx Application Server.


For help on sending emails via Linx, go here.


Also see

Working with Plugins