Skip to main content Skip to complementary content

Check an expression

Check that an expression is valid by using the CheckExpression method or the CheckNumberOrExpression method.

Check that a number is correct according to the locale by using the CheckNumberOrExpression method.

Examples

The goal is to check that an expression or a number is correct.

Example 1:  

The entered expression is correct. The handle of the app is 1.

The client sends:

{ "jsonrpc": "2.0", "id": 1, "method": "CheckExpression", "handle": 1, "params": [ "=Count(Country)" ] }

The engine returns:

{ "jsonrpc": "2.0", "id": 1, "result": { "qErrorMsg": "", "qBadFieldNames": [], "qDangerousFieldNames": [] } }

The expression is correct. No error message is returned.

Example 2:  

The entered expression is not correct. The handle of the app is 1.

The client sends:

{ "jsonrpc": "2.0", "id": 2, "method": "CheckExpression", "handle": 1, "params": [ "Count(Countryeee)" ] }

The engine returns:

{ "jsonrpc": "2.0", "id": 2, "result": { "qErrorMsg": "", "qBadFieldNames": [ { "qFrom": 6, "qCount": 10 } ], "qDangerousFieldNames": [] } }

The expression is not correct. The field name located between the character 6 and 16 (=6+10) is wrong.

Example 3:  

The entered expression is not correct. The handle of the app is 1.

The client sends:

{ "jsonrpc": "2.0", "id": 3, "method": "CheckExpression", "handle": 1, "params": [ "Coun(Country))" ] }

The engine returns:

{ "jsonrpc": "2.0", "id": 3, "result": { "qErrorMsg": "Error in expression:\nCOUN is not a valid function\n", "qBadFieldNames": [], "qDangerousFieldNames": [] } }

The expression is not correct. There is a syntax error.

Example 4:  

The goal is to check that the number 10 000 is correct. The handle of the app is 1.

The client sends:

{ "jsonrpc": "2.0", "id": 9, "method": "CheckNumberOrExpression", "handle": 1, "params": [ "10 000" ] }

The engine returns:

{ "jsonrpc": "2.0", "id": 9, "result": { "qErrorMsg": "", "qBadFieldNames": [] } }

The number is correct. There is no syntax error.

Example 5:  

The goal is to check that the number 10,000 is correct. The handle of the app is 1.

The client sends:

{ "jsonrpc": "2.0", "id": 11, "method": "CheckNumberOrExpression", "handle": 1, "params": [ "10,000" ] }

The engine returns:

{ "jsonrpc": "2.0", "id": 11, "result": { "qErrorMsg": "", "qBadFieldNames": [] } }

The number is correct. The comma "," is defined in the locale as being the thousand separator, so there is no syntax error.

Example 6:  

The goal is to check that the number 10:000 is not correct. The handle of the app is 1.

The client sends:

{ "jsonrpc": "2.0", "id": 13, "method": "CheckNumberOrExpression", "handle": 1, "params": [ "10:000" ] }

The engine returns:

{ "jsonrpc": "2.0", "id": 13, "result": { "qErrorMsg": "Garbage after expression: ':'", "qBadFieldNames": [] } }

The number is incorrect. The symbol ":" is not defined in the locale, therefore 10:000 is not a valid number. "10:000" is not a valid expression as well, so an error message is returned.

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – let us know how we can improve!