Script Syntax

Production > Product Configurator > Product configurator definition > Configuration structure > Script Syntax

Top  Previous  Next
Expand/Collapse Toggles

Several programming languages can be used in the Product Configurator script fields.

Existing parameter, which have already been defined in the configurator, can be easily accessed using a placeholder.

 

The SQL formula syntax is set by default.

 

Note:      When using the SQL formula, database accesses may reduce the performance of the configurator window.

 

hmtoggle_plus1SQL Formula

 

This simplified use of the SQL syntax only specifies what should be returned.

The system then creates the following syntax:

select <your script> from "BEAS_DUMMY"

 

Example: Input: 3.5 * 4

t is executed: select 3.5 * 4 from "BEAS_DUMMY"

 

If information from a product configurator parameter is required, enclose the parameter in square brackets.

Example: [sofa_width] * 4

If the width is 300, following is executed: select 300 * 4 from "BEAS_DUMMY"

 

Note

Since different country settings of the database or Windows system can cause issues with decimal numbers and date definitions, these must be used with the parameters/set-objects (similar to Beas script) formatting beas 9.2 PL: 05 (5.13).

 

SQL conversions can be used for:  

numeric values [value,num] or date [date,dbdate] or string [stringparameter,dbstring]

Example:

[sofa_length,num] * 4   (with sofa_length: 200,5)

 

You can insert complete sql statements

Example:  Return UDF-Field: U_MaterialColor

select "U_MaterialColor" from "OITM" where "ItemCode"=[my_itemcode,dbstring]

 

Important: Do not forget the quotation marks at placeholder if it is about a reference.

 

 

Example: Visibility Rule

A selection element of a list should only be displayed if the parameter "cushions" has the content "Y":

[cushions] = 'Y'

 

Example: Assign a value (or text) to a Set object

If the content of the parameter "headrest" has the content "Y" then assign "Y", otherwise "N":

case when [headrest]='Y' then 'Y' else 'N' end

 

 

HANA

You must always define a table in HANA.

Without defining a table, the system automatically inserts  the keyword  ' from "BEAS_DUMMY" '

If you work with complete SQL statements or with sub-select commands, you must define the Table.

 

Note:  Beas Script placeholder ( <placeholder>) not supported.

 

Examples:

sofa_width=300, numeric value

Example

Executed SQL command

[sofa_width] * 4

select 300 * 4 from "BEAS_DUMMY"

select [sofa_width] * 4

select 300 * 4 from "BEAS_DUMMY"

select "ItemName" from "OITM" where "ItemCode"='1111'

select "ItemName" from "OITM" where "ItemCode"='1111'

the system find the keyword "from" inside the sql statement and don't insert the "BEAS_DUMMY"

(select "ItemName" from "OITM" where "ItemCode"='1111') || 'hello'

select (select "ItemName" from "OITM" where "ItemCode"='1111') || 'hello'

 

Open bracket without closing bracket creates a sub-select command.

 

The system finds the keyword "from" inside the sql statement and does not insert the "BEAS_DUMMY"

This is working in MSSQL, but not in HANA, because we miss table "BEAS_DUMMY" outside the sub-select command.

select "ItemName" || 'hello' from "OITM" where "ItemCode"='1111'

select "ItemName" || 'hello' from "OITM" where "ItemCode"='1111'

 

It is working in Hana and MSSQL.

 

 

hmtoggle_plus1JavaScript Formula

 

Example:  Visibility Rule.

A selection element of a list should only be displayed if the parameter "cushions" has the content "Y":

[cushions] == 'Y'

 

hmtoggle_plus1JavaScript

 

Example:  Visibility Rule.

A selection element of a list should only be displayed if the parameter "cushions" has the content "Y":

result = [cushions] == 'Y'

 

Example:  Check the contents of a parameter.

Checking if you need a headrest for an armchair (number of seats = 1):

if ([numberofseats] == "2" || [numberofseats] == "3")

    result=1

 else

    result=-1;

 

hmtoggle_plus1VBScript-Formel

 

Example:  Visibility Rule.

A selection element of a list should only be displayed if the parameter "cushions" has the content "Y":

[cushions] = "Y"

 

hmtoggle_plus1VBScript

 

Example:  Visibility Rule.

A selection element of a list should only be displayed if the parameter "cushions" has the content "Y":

if [cushions] = 'Y' then

   result=1

 else

   result=-1

end if

 

hmtoggle_plus1DW Syntax

Datawindow Syntax.

This is the most powerful scripting language to use in the visibility rules and set objects.

(from Beas 9.3-PL0)

 

Example:  Visibility Rule.

A selection element of a list should only be displayed if the parameter "cushions" has the content "Y":

'[cushions]' = 'Y'

 

See Datawindow-Syntax

 

The following standard parameters are available

Parameter Name

Description

cprice

Price from a price list (only for the Price calculation field)

cpricequantity

Calculated quantity for this item (only for the Price calculation field)

cpricetotalquantity

Calculated quantity * Quantity from sales order / quotation (only for the Price calculation field)

cdiscount

Discount of the current business partner

cpricelist

Price list of the current business partner

currentuser

Current user

cardcode

Business partner from the sales order

cquantity

Quantity from the sales order

cdocdate

Date from the sales order in yyyy/mm/dd format

cshortvariant

Short variant A-Z


Help URL: https://help.beascloud.com/beas202102/index.html?config_syntax.htm