Using parametric table scripts in LIONoso
LIONoso provides a tool to generate a table on the fly based on some input parameters.
This tool, called Parametric table can be found in the Table manipulation and creation toolbar folder
and requires the user to provide an external script or binary executable following some simple guidelines.
External script properties
In order to seamlessly work within LIONoso, the script (or executable program) must follow these specifications. Please download
this python script and refer to it as an example.
The script can be written in any language, provided that it can be invoked from the command line by just typing its file name
(possibly followed by a sequence of space-separated parameters).
Test: open a command prompt window, cd to the script's folder and type the script's filename: does it execute?
Troubleshooting: if it's a binary program (e.g., compiled), then it has to work properly.
Otherwise, provided that the corresponding interpreter is installed,
you should check the file execution permissions, the file's extension (particularly important in Windows), and (on Mac OS X) that the first line correctly
invokes the interpreter (usually "#! /usr/bin/interpretername").
Example: Check the first line of the sample python script.
When invoked from the command line without parameters, the script must return information about the input arguments in the following form:
Test: open a command prompt window, cd to the script's folder and type the script's filename: does it print the required information?
Troubleshooting: the program should check for the number of command line arguments, and if none is provided then the above-defined string
should be printed. Observe where tabs (usually "\t" in strings) and newlines ("\n") must be inserted.
Example: When executed without command line arguments, the sample python script must
return the following info:
Number of lines<tab>10<newline>
Otherwise, the script should accept the following command line arguments, separated by spaces:
value_of_first_parameter ... value_of_last_parameter 0 output_filename.csv
In this case, the script creates the file output_filename.csv containing a CSV table that will be loaded by LIONoso.
The input parameters can be used to guide the table creation, as in the example. Remember the "0" argument before the output filename,
which is reserved for advanced applications. Also, the output file must be created only at the script's conclusion: the script can
create a file with a temporary name, and rename it only at the end.
Test: open a command prompt window, cd to the script's folder and type the script's filename followed by the appropriate arguments:
it shouldn't print anything, but a file should be created.
Troubleshooting: remember the "0" argument before the output filename. Remember to use a temporary name during the script execution,
to be renamed only at the end.
Example: launch the sample python script from the command line with the following arguments:
Script_name 10 20 0 test.csv
This generates a 10-entry csv table with random numbers between 0 and 20, contained in file test.csv