dropdown Script

beasscript-logo-small

BS: With the Script method you can format the drop-down after creation

 

item.[mycolumn].dropdown.script=modify={datawindow sysntax}

 

Best place to change the drop-down is the event drop-down, example for udf1 in dw_1

global function dw_1_item_udf1_dropdown
dw_1_item_udf_1.dropdown=script=...
end global

 

if you need additional script lines, you can execute this command for every line

scriptadd: add the script line

script : insert the script and replace existing. Node: Standard definition will be overwrite too

 

Example: column udf1: change color from dropdown column "stock"

item.udf1.dropdown.script=modify=stock.color="255"

 

Change to red, if stock < 1

item.udf1.dropdown.script=modify=stock.color="0~tif(stock<1,255,0)

 

It's allowed to work with place holder and line feeds

item.udf1.dropdown.scriptadd=insertrow=0<cr_lf>set=itemcode=abc

 

Best place to define the dropdown script is event

global function dw_x_item_fieldname_dropdown

 

Example

// field itemcode in dropdown is red
global function dw_1_item_udf1_dropdown
dw_1.item.udf1.dropdown.script.modify=itemcode.color="255"
end global

 

Find out the correct field name:

Open debug window
move mouse over the field in the drop-down list

Now you can see the field name in the first line in the debug window - in this case "batchattribute1"

dropdownfieldname

 

Properties

 

Property

Description

modify=<dw script>

modify the datawindow

With this command you can change all datawindow properties from the drop-down list from type datawindow

see datawindow

 

Example: change color from field batch. Use "red", if status not 0

 

global function dw_1_item_bin_from_dropdown
dw_1.item.bin_from.dropdown.scriptadd=modify=batch.color="0~tif(status='0',0,255)"
end global

 

Syntax is always

FieldName.Property="standard value ~t conditions"

 

if you want to change more then one condition, then use <cr_lf>

...scriptadd=modify=...<cr_lf>&
  modfiy=...

 

set=field[row]=value

modify a field

set=ItemCode="hello"
set=ItemCode[3]="hello"

insertrow=<row>

insert new row on this position. Set cursor on the new row

Example: Insert in LUID field 2 additional lines: No and New

dropdownscriptinsert

 

setvar=ls_script=deleteemptyrows<cr_lf>&
insertrow=1<cr_lf>&
rfid=new<cr_lf><cr_lf>&
set=sscc=<spr:New Pallet><cr_lf>&
insertrow=1<cr_lf>&
set=rfid=no<cr_lf>&
set=sscc=<spr:No Pallet Assignation><cr_lf>
modify=sscc.color="0~tif(rfid='new' or rfid='no',rgb(0,0,200),0)"<cr_lf>&
modify=rfid_t.text="LUID"

dw_1.item.rfid.dropdown.script=<ls_script>

deleterow=<row>

delete this row

deleteemptyrows

delete all empty rows

Check only first column. This column must be type "char"

sort=<dw-syntax>

sort the result

filter=<dw-syntax>

set filter

title=<title text>

replace title for this column

format

change format, name, field type of field

Note: Only possible if the drop-down returns the result of BSL. For customization use the drop-down event.

 

// Example: 
// - make field "status" unvisible (better on this place and not with modify)
// - replace field "onhand" with expression with formula (not possible with modify command)
// - replace title
global function dw_1_item_bin_from_dropdown
dw_1.item.bin_from.dropdown.scriptadd=format=status=visible=0<cr_lf>&
      format=onhand=expression=onhand - ReservedQuantity + ReservedQuantityforbom,t=<spr:Verfügbar>
end global

 

For all available properties see Format Properties

setrow=<row>

set cursor to this row

sort=<dw-syntax>

define datawindow sort

Example: order by Batch descending

dw_1.item.rfid.dropdown.scriptadd=sort=batch desc

filter=<dw-syntax>

define datawindow filter

Example

dw_1.item.bin_from.dropdown.scriptadd=filter=onhand - ReservedQuantity + ReservedQuantityforbom > 0