Navigation: Build Your Own ERP > Parser >

Parser Overview

 

 

 

The system uses a parser that can evaluate mathematical and if-then-else expressions. The following are the three major features of the parser:

1.Parses strings that contain formulas into expression objects that can be further evaluated.

2.Parses control objects to get the values they represent.

3.Evaluates expression and returns the result

Following are string formula expressions that the parser evaluates and return the result. Always use lower case when using the if, or, and functions.

Formula Expression

Return Value

Remarks

112/1.12*.12

12.00

The formula expression is a string type that the parser will evaluate.

(112/1.12)*.12

12.00

You can use ( ) for a more readable formula

if(5+2 > 5*2,'True','False')

False

Syntax: if(expression to be evaluated, return true value, return false value)

if(5+2 > 5*2 and 1=1,'True','False')

False

IF with AND function

if(5+2 > 5*2 or 1=1,'True','False')

True

IF with OR function

if(5+2 > 5*2, 'True', if(1=1, 'Still True', 'Still False'))

Still True

Nested IFs

if(#12/31/2020# > #12/31/2019#,'True statement','False statement')

True statement

Dates must be enclosed with #

if('y' = 'y' ,'True statement','False statement')

True statement

Strings must be enclosed with ' (single quote)


 The parser includes ParseControlExpression that can retrieve the actual value from a given control or object. The following are the four controls or objects that the parser is capable to access and retrieve their values.

1. Date grid control. Click here for details.

2. Iinput panel control. Click here for details.

3. Pagination object. Click here for details.

4. Dataset object. Click here for details.

 

 

 

 


 


 

 

 

Copyright © 2021 Terasoft Corporation