Troubleshooting SRL errors

The SRL syntax errors are displayed when PolyAnalyst cannot determine the syntax of your query. In case of an error, you will see a pop-up message indicating the row and column (the number of characters from the beginning of the line, including spaces) where the error occurred.

For example:

The expression 2 > 2 will return false.

Let’s show the incorrect use of the operator:

Expression 2 :> 2 will return an error.

This expression will result in error as there is no :> operator in SRL. In this case, you will see a message like:

This expression is neither SRL nor PDL expression, errors are:

SRL: line 1 col 3: syntax error at ":>" missing { % "<end of expression>" operator "xor" "and" "or" "," ")" }

PDL: line 1 col 1: syntax error at "2" missing { "!" "false" "true" "yes" "mod" "no" string identifier number }

Note that PolyAnalyst tracks both the SRL and PDL syntax. See here about using PDL inside SRL expressions.

Where PolyAnalyst begins having a problem with a syntax error is not always where the actual error occurs. For example, if we type the column name [My Column] but omit the ending bracket, PolyAnalyst may report that the error starts at the beginning bracket (because an ending bracket was not found).

There are innumerable reasons for why this error occurred. Here is a brief list of some of the reasons:

  • invalid use of whitespace (remember to separate certain operators from values by at least one space);

  • invalid use of brackets when naming a column;

  • typing in a literal value but not using quotes correctly;

  • forgetting a parenthesis, or adding an extra parenthesis;

  • typing in the name of a function incorrectly;

  • adding an extra comma or missing a comma when specifying arguments for a function;

  • invalid use of an operator (like 1 + or 1 + + 2).

PolyAnalyst occasionally tolerates improper SRL syntax

In limited cases, you are able to write expressions which are not syntactically correct. Lazy evaluation in such cases does make it harder to troubleshoot an expression that is not producing the desired behavior. The following are examples of lazy syntax:

  • 1,2 – in this case, the comma character and the character 2 are ignored and the value 1 is used (only if 2 is the last section of the entire SRL expression);

  • (1 + 2)) – in this case, the extra closing parenthesis character is ignored. This is only if this is the last section of an expression;

  • "dog"" – in this case, the extra double quote character is ignored (this is only if this is the last section of an expression).

Troubleshooting "column not found" errors

This error is seen when you reference the name of a column in your expression, but that column could not be found in the list of existing columns in the dataset. Perhaps you mistyped the column name, or misspelled it, or there is no such column.

Column names are case-sensitive inside SRL expressions, so perhaps you are not using the correct case. If the column name has a space in it, you need to use brackets around the column name to let PolyAnalyst know you are referring to a single column, like [My Column].

Troubleshooting "wrong number of arguments" errors

This error is displayed when using the wrong number of arguments for a function.

For example, the abs() function takes one argument, a number. If you pass in two numbers, like abs(3, 4), then you are passing in the wrong number of arguments and this error will be displayed.

Note that this error frequently occurs because you forgot to use a comma somewhere in an expression, or because you added in an extra comma somewhere in the expression, e.g. the abs(3,) query will result in error.

Troubleshooting "arguments types mismatch" errors

This error is displayed when PolyAnalyst is evaluating the use of a function inside the expression, and evaluates its arguments, and determines that the data type of one or more of the arguments is incorrect.

The abs() function in SRL takes a number and returns the absolute value of the number.

If you pass a date or a Boolean or a String value instead of a number, you are passing the incorrect data type to the function, and this will result in error.