Tosdata

This function returns a string value containing an SData where syntax corresponding to a Sage X3 valid condition.

Syntax

STRING=toSData(VARIABLES, SDATA_VAR, EXPRESSION)

Example

Local Char VARS(20)(1..3), COLS(20)(1..3), MY_EXPRESSION(200),SDATA_EXPRESSION(200)VARS(1)="country" : VARS(2)="city" : VARS(3)="total"COLS(1)="COUNTRYCODE" : COLS(2)="CITYNAME" : COLS(3)="AMOUNT"# Transform the expressionMY_EXPRESSION="find(CITYNAME,'London','Paris')<>0 and (AMOUNT>=1 and AMOUNT<=100) and COUNTRYCODE<>'BE'"SDATA_EXPRESSION=toSData(COLS,VARS,MY_EXPRESSION)# The contents of SDATA_EXPRESSION is now:# "(city in 'London','Paris') and (total between 1 and 10) and country ne 'BE'"

Comments

This function only supports the following subset of the Sage X3 syntax:

Expressions that are not based on unary expressions are not accepted and trigger an error. The following table provides incorrect syntaxes and the correct equivalent syntaxes:

Incorrect syntaxCorrect syntax
pat(NAME,"*A*")pat(NAME,"*A*")<>0
find(NAME,"A","B","C")find(NAME,"A","B","C")<>0
AMOUNTAMOUNT<>0

See also

evalueSData