Beas Product Configurator, how to use scripting to change properties in the UI (Detail Area)

  • Updated

Article Type: Tips & Tricks

Product AREA: Beas

TOPIC / SYSTEM AREA (Beas): Product Configurator

System Functionality: Scripting

 

Scenario description

We are asked from time to time by the support if it is possible to make simple changes/adaptations via scripting in the detail area of the configurator.

Yes... you can....

 

Solution

The detail area of the configurator is dynamically rebuilt at runtime each time a new block is selected on the left side of the navigation area.

Thus, the fields (in data window dw_2) are also created dynamically and are filled and displayed according to the definition of the coding.

 

Because the configurator calculates all values for each change/action in the detail area and displays or suppresses fields based on the results, this reaction must be triggered for a scripting.

But since no change is executed by the user when the window is opened for the first time, scripting is necessary here as well.

For a scripting the unique name of the parameter is the key for identifying the corresponding field in the detail area.

 

In order to obtain a clear programming, the best way it to work with 2 events which call the same sub-function in each case:

 

global function form_loaded

  // modyfing property after start of window

  change_properties()

end global

 

global function form_rowfocuschanged

  // refresh modyfing property after start of window

  change_properties()

end global

 

 

Examples:

Field protection

A field should be used to give the user only an information and the contents must not be changed. A protection of the field is needed.

global function change_properties

  // after the window content has been built up in the right block, manipulate field

  if <dw_2.rowcount> n< 2 then

     // no line for modifying, end scripting

     goto=end_dw2_changed

  end if

  // Protect field against input/update

  dw_2.modify=inhalt.protect="0~tif(parameter='info',1,0)" 

  [end_dw2_changed]

end global

 

The known statement for modifying an item is used here.

 

Mode of operation:

If the datawindow field "parameter" of the current line contains the value "info", the visible datawindow field "input" should be protected with the contained value (result information).

If more fields (also in other detail areas/blocks) should be protected, only a line for the parameter name is to added in the script.

 

Field coloring

For a better visibility a field content should be colored.

global function change_properties

  // after the window content has been built up in the right block, manipulate field

  if <dw_2.rowcount> n< 2 then

     // no line for modifying, end scripting

     goto=end_dw2_changed

  end if

  // field content in color red

   dw_2.modify=inhalt.color="0~tif(parameter='frame',rgb(255,0,0),0)" 

  [end_dw2_changed]

end global

 

The known statement for modifying an item is used here.

 

 

 

Was this article helpful?

0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.