Source Code Preprocessor (coming soon)

The source code inside blocks are treated as templates which get preprocessed before passing to the host language interpreter.

Inside templates users are able to use control flow constructs, like loops and conditions and interpolation expressions. Interpolation expressions within templates are evaluated and their string representation is automatically inserted at the position. If an interpolation expression evaluates to null an empty string is added.



Expressions insert value of the CoginitiScript expression into a final code. {{ and }} delimiters are used to insert an expression into a template code.


{{ 1 + 1 }}
{{ "string" }}
{{ i > 5 }}
{{ variable_name }}



Conditions allows to execute arbitrary piece of code based on condition. It is defined using #+if statement.

#+if debug == true then
  SELECT ...;

You can also use IF...ELSE...END constructs.

#+if debug == true then
   SELECT ...;
   SELECT ....;



Provides ability to loop over items in the collection.

#+for el : elements do
  {{ el }}

It optionally allows to specify what to prepend (BEFORE), put in-between (SEPARATOR), and what to put at the end (AFTER) of all iterations. BEFORE and AFTER are only executed if there is at least one iteration. (SEPARATOR) is only added between iterations. It is executed if there are at least two iterations.

#+src sql queryCustomers(fields)
#+for f : fields separator "," do
   {{ el }}


Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request