dw_1 (dw_2, dw_3...dw_7, dw_edit)

The dw_1 ( DataWindow ) or dw_2....dw_7 objects are visual components on each form.

This is a sub object of the window object.

 

Window -> dw_x -> Item

 

x = DataWindow 1 to 7. Usually, only DataWindow 1 is active (always).

In events you can define it with "this" (this = current datawindow).

Properties

Property

R

W

Description

accepttext

 

x

Accept text from the input field and store it in the data buffer.

border=true/false

 

x

 

TRUE - Has a border
FALSE - Does not have a border

borderstyle=x

 

x

Specifies the style of the border of the control. Values are: box, lowered, raised, shadowbox.

bsl.get

 

x

 

Field names from result and field names in Datawindow must be the same

 

dw_1.bsl.get=WareHouseStock("BW")?$select=ItemCode,IVersionId,Batch,SysNumber,UoMCode,BinCode,RFID,OnHand,Details,Status

color

 

x

Set the color

columncount

x

 

 

setvar=ls_columns=
for ll_loop=1 to <dw_1.columncount>
   addvar=ls_columns=<dw_1.columnname:[ll_loop]>,
next
messagebox=Columns: <ls_columns>

columnname=x

x

 

Return the name of the column with field number x. See example in columncount.

create

 

x

Create a new item. See create.

dw_2.create=column=id=userfield1,name=myfield

createdataobject

 

 

x

createdataobject=style=sqlsyntax

Example

dw_2=createdataobject=grid=select "ItemCode" from "OITM"

crtldoubleclick=true/false

 

x

 

With CTRL+double-click you can modify column properties (default).

Disable this functionality by setting it to false.

 

Example

dw_2.crtldoubleclick=false

dataobject

x

x

 

This is the file name of the datawindow formula (PSR-File name).

For set datawindow, use the init command dw_1.init=<psr-filename>

dataxxxx (XML/XLS,LFO)

x

 

 

HTML/XLS

(only read)

datahtml

Description of the data and format of the DataWindow in HTML format.

messagebox=<dw_1.datahtml>

datahtmltable

Description of the data in the DataWindow in HTML table format.

dataxhtml

A string containing the row data content of the DataWindow object in XHTML format.

dataxml

A string containing the row data content of the DataWindow object in XML format.

dataxmldtd

A string containing the full document type definition (DTD) of the XML output for a DataWindow object.

dataxmlschema

A string containing the full schema of the XML output of a DataWindow object.

dataxmlweb

A string containing browser-specific JavaScript that performs the XSLT transformation on the browser after the XML Web DataWindow generator generates all necessary components.

dataxslfo

A string containing XSL Formatting Objects (XSL-FO) that represents the data and presentation of the DataWindow object.

 

deleterow=<row>

 

x

Delete row <row>

describe=x

x

 

 

Other form gets all object values from a datawindow object.

There is full access to all objects inside this datawindow object. For more information, see the PowerBuilder documentation.

 

messagebox=<dw_1.describe=itemcode.x>

deselectrow=x

 

x

deselect a row (see multiselect)

design=<designtype>

 

x

 

The command defines, whether it is a list, edit window, or some other object.

 

The following properties are allowed:

liste

design for lists, reports

edit

edit window

editliste

list, in which you can change fields

struktur

structure window

selection

choose window

 

beas sets the correct style, for example underlined, border around fields, and so on.

 

Example:

dw_2.design=edit

 

With the "<dw_2.type>"  property you can check the current design in 2 areas: browse or edit

dw_x.is_type

drag=<propertie>

 

x

 

dw_1.drag.auto=true  activates the auto-drag function

dw_1.drag.begin

dw_1.drag.end

dw_1.drag.cancel

dynamiccol=true/false

 

x

 

See

setdynamicgridcols

setupcolumn

dynamiccolname

 

x

 

Default names for a dynamic columns are the data window name. This setting can change this default behavior.

 

See

setdynamicgridcols

setupcolumn

dwname

x

 

 

This is the id and name from the window, which usually is the psr file name of first datawindow dw_1 inside current window without folder name and postfix .psr

 

messagebox=<dw_1.dwname>

unvisiblefields

x

x

Dynamic browse window (columns defined with Crtl+NS)

With this variable you can define, which fields unvisible. In this case you can't see it and you can't activate this in the window settings

dw_1.unvisiblefields=field1;field2;field3...

see

dw_x.editablefields

editablefields

x

x

Dynamic browse window (columns defined with Crtl+NS)

With this setting you can define, which fields editable.

If you define this, all fields, which not defined, are not editable

In window settings only fields editable, which defined in this setting or the setting is empty

 

dw_x.editablefields=field1;field2;field3...

see

dw_x.unvisiblefields

enabled=true/false

 

x

Enabled datawindow true/false

excelexport=true/false

 

x

 

true=allowed, false=not allowed. Default=true

Example: Structureview - set xls export to false because you cannot use this.

filter

x

x

Take over the filter

filtercount

x

 

 

dw_4.setfilter=itemcode>'a'

dw_4.filter

messagebox=Current filtered: <filtercount>, current visible: <rowcount>

 

filtersort

 

x

 

A right-click on a title presents a pop-up window with the definition of the the filter/sort of the list.

This command can deactivate this behavior.

 

dw_4.filtersort=false

find

 

 

x

 

If the value is not found, value=0. If the search syntax is not correct, the value is -1.

dw_2.find=itemcode='sofa' or itemcode='table'

setvar=ll_row=<value>

if <ll_row> n> 0 then

 messagebox=Description from <dw_2.itemcode:[ll_row].value>: &

            <dw_2.itemname:[ll_row].value>

end if

find=<propertie>

 

x

Find the row which agrees with the property.

Return value is stored inside "value".

Example:

dw_1.find=itemcode="b005"

getcolumns

x

 

 

Example: Returns all columns from the stamm_stl_header window.

(only if the form is active)

setvar=ls_window=stamm_stlheader_edit

setvar=ls_dw=dw_1

setvar=ls_test=<system.window.[ls_window].form.[ls_dw].getcolumns>

messagebox=<ls_test>

 

getrow

x

 

Gets the current row.

getselectenrtyrow

x

 

Returns the selected rows. For example: 5,10,11,12

getselectentrydata

x

 

Returns the values of the primary-key from the select rows and current row, Example: value1,value2,...

getselectentrysql

x

 

Returns the values in SQL-style of the primary-key from select rows and current rows example: 'value1','value2',...

grouping=field

 

x

Window.PSR-SQL

select OITM.ItemCode+'' || ItemCode FROM OITM inner join OITW where OITW.ItemCode = OITM.ItemCode

// you have one entry per Warehouse, 6 Entries for Item A if A is linked to 6 warehouses

dw_1=grouping=itemname

// now you have one line per Itemcode

horizontalscrollposition

x

 

Returns the horizontal scroll position.

horizontalscrollposition=x

 

 

Sets the horizontal position.

horizontalscrollposition2=x

 

x

 

dw_2.hscrollbar=true

dw_2.hsplitscroll=true

dw_2.horizontalscrollposition2=500

horizontalscrollsplit=x

 

x

Defines position of the split bar.

hscrollbar=true/false

 

x

Horizontal scroll bar

horizontalscroll=true/false

 

x

Disable or enable horizontal scroll function. Standard = true

If you insert a ue_tab or ue_code_editor, the horizontal scroll is automatically disabled.

hsplitscroll=true/false

 

x

Enables/disables the horizontal split function.

importxxxxx

 

x

Import from other source into the Datawindow. See export/import

init=<datawindowfile.psr>

 

x

 

Load the psr-file and initialize is:
dw_2=init=myfile.psr

 

No retrieve is triggerd.

An initcols is automatically performed.

 

dw_2.init=myfile.psr

dw_2.design=liste

// retrieve:

dw_2.retrieve

// or only connect to database

dw_2.settrans

 

// List window: load column definitions

dw_2.setdynamicgridcols

initcols

 

 

x

Columns are initialized and formatted.

 

dw_1.initcols

insertow=<row>

x

x

Insert row after "row".

If row = 0 then insert row at the end.

isselect

x

 

 

Example:

<dw_1.isselect> returns true/false for the current row

<dw_1.isselect:5> returns true/false for row 5

<dw_1.isselect:[ll_loop]> returns true/false for row from Variable ll_loop

isselectonerow

x

 

 

Example:

dw_1.multiselect=true
dw_1.selectrow=5
messagebox=<dw_1.isselectonerow>   returns true

item.x=y

 

x

Accesses the item object of the DataWindow. See item.

lastobject

x

 

Returns the last changed item.

lastrow

x

 

Returns the row, in which the last item was changed

loadpsr=file

 

x

load this psr file with data inside the file

maxrow

x

x

define max. rows, which the retrieve command can loading

markierung=j

 

 

x

Is the marking activated, the current line is always be marked in the marking color.

modify

 

x

you can change every datawindow directly with datawindow syntax

 

Example:

 

Change height of the detail window

dw_1=modify=DataWindow.Detail.Height=70

 

 

Color and other column properties allow to work with formula

"Default Value"+Tab+"if(formula,true-Value,false-Value)"

 

For Tab you must use "~t"

 

Example:

Change Color from a field related to a formula

dw_1.modify=bez.color="0~tif(ag_id='1111',rgb(255,0,200),0)"

 

Execute the script after opening the window , example form_loaded

 

global function form_loaded
dw_1.modify=bez.color="0~tif(ag_id='1111',rgb(255,0,0),0)"
end global

 

 

if this is related to a template, you can write this in scripts from the template

 

modify_template

 

 

More information see Appeon Powerbuilder documentation

https://docs.appeon.com/pb2019/datawindow_reference/ch05s01.html#XREF_78721_Using_DataWindow

 

 

Example:

Item List with Pictures
templatewithpictures
 
First we need the picture. We can use a template field in template definition
templatefieldpicture

 
Then we must change the height of row and Picture

Follow syntax in template - Script:

dw_1.modify=DataWindow.Detail.Height=200
dw_1.modify=templatefield1_c.Height=200

 
 

move=x,y,width,height

 

x

With this function we can set the x,y,wifdth and height values in one single row.

multiselect=true/false

 

x

 

You can select multiple lines with the mouse, keyboard or with commands.

 

Activate or deactivate multiselect: select row with Shift/Control + rowfocuschange. See selectrow, deselectrow.

Example:

dw_1.multiselect=true

 

To check the selected rows:

<dw_1.isselect> return true/false for current row

<dw_1.isselect:x> return true/false for row x

<dw_1.isselectonerow> return true, if min one row is marked

<dw_1.getselectentrydata> return selected data from binary field

<dw_1.getselectentryssql> return first primary field from all selected rows, all Data in ", example "value1","value2", ...

<dw_1.getselectentryrow> return all selected rows

 

Examples:

dw_1.multiselect=true

messagebox=<dw_1.getselectentrydata>

tools=isql=select * from "OITM" where "ItemCode" in (<dw_1.getselectentrysql>)

 

youtube Examples for Work order structures

order1, order2

x

 

Returns the current SQL order.

orientation

 

x

1=landscape

2=portrait

dw_2.orientation=2

print

 

x

Print DataWindow dw_2.print

printwithdialog

 

x

Print DataWindow with print dialog dw_2.printwidhtdialog

redraw / setredraw / freeze

 

x

Redraw / activate redraw / deactivate redraw

rightclick

 

 

 

global function dw_1_rightclick

// function

end global

 

reset

 

x

Resets the DataWindow

retrieve=[parameter]

 

x

 

Parameters must be separated with "="

The DataWindow must only have string arguments.

Arguments are passed 1:1. Only 10 parameters max are allowed.

dw_1.retrieve=<str_parm.belnr_id>=<str_parm.belpos_id>

 

Retrieves only the maximum defined rows using the general setting or this can be overwritten with maxrow.

dw_1.maxrow=999999

rowcount

x

 

Returns the count of rows.

rowmove=fromrow=torow

 

x

Moves a row from the source to the target row.

dw_2.rowmove=3=5

saveasxxxxx

 

x

Export, save datawindow. See export/import.

scrolltorow=<row>

 

x

Scroll to row.

selectedtext

x

 

Returns the marked text from a text field item.

selectrow=x

 

x

Selects a row (see multiselect).

setdatefilter=<fieldname>

 

x

 

Example:

dw_2.setdatefilter=fromdate

 

setdetailheight=v1=v2=v3

 

 

x

setdetailheight from row v1 to row v2 with height v3

setdynamicgridcols

 

x

 

It is not required to set this in dw_1, but it is required in any further data window, dw_2...7.

 

See

dynamiccol

dynamiccolname

setfilter

 

x

x

 

dw_2.setfilter=itemcode=[myitem]

dw_2.filter

Should the user define the filter, the parameter would be "user":

dw_2.setfilter=user

dw_2.filter

or you have 2 columns (example):

dw_2.setfilter=whscode="01" and color_id=1

dw_2.filter

setposition=[position]

 

 

 

dw_1.setposition=behind

dw_1.setposition=tobottom

dw_1.setposition=totop

 

Do not use this command. Beas has its own "redraw" mode with the following order:

dw_master - dw_1 - dw_2 ... dw_7 - rtf object - html object

setrow=<row>

 

 

Set currentrow to row

setsort

 

x

x

 

Sorts the current data window.

Use the datawindow syntax for arguments. Placeholders are not allowed.

 

Only sort data, which is loaded in current datastore.

 

Information:

If you load the item list, beas is loading the first 200 entries only.

If you define a setsort, beas make this setsort only for these 200 entries and not for the complete item list.

 

Use this function only, if all data is loaded.

 

Example:

dw_2.setsort=u_matgrp,itemcode

dw_2.sort

// Should the user define the sorting, the parameter would be "user":

dw_2.setsort=user

dw_2.sort

settransaction

 

x

 

This command is required, if you do not use a retrieve command and if work with dw_2...dw_7

 

dw_2.init=myfile.psr

dw_2.settransaction

 

Alternative:

dw_2.settrans

 

If a connection to another database / table is required, use transaction method.

setupcolumn

 

x

 

See

setdynamicgridcols

dynamiccolname

 

sort

x

x

Take over the setting. See setsort.

sql2datawindow

 

x

 

Creates a new DataWindow form:

 

sql2form=browse/edit=<sql command>

 

 

sum=<columnname>

x

 

Returns the sum of a columns from all rows, for example: messagebox=<dw_1.sum=onhand>

tableselect=x

x

x

Get / Set the SQL Statement of the DataWindow.

setvar=mysql=<dw_2.tableselect>

tools=globalreplace=mysql=[c_parm1]=<str_parm.c_parm1,#0>

dw_2.tableselect=<mysql>

Important:

Do not use this with dw_1, but only in sql event.

template

 

x

 

Up to 6 templates can be defined in template administration.

Templatefield 1-6 in lists can be set with template or with script. This is only running in user-Event.

windowevent predesign

dw_1.template.x.property=value

end event

 

template.x.sql

 

SQL-Sequence - always defined as a string, varchar(50).

 

Read the template information with: <template.sql.1>, ....<template.sql.6>

template.x.text

Title

template.x.format

 

#.#  convert to number

datecolor   convert to date, set to red, if date in the past

date    convert to date

time    convert to time

bitmap  convert to bitmap (full path)

sapbitmap   convert sap-picture (without path)

 

template.x.alignment

1=left

replacetemplatefields

Replace all space(50) as templatefieldX in the current datawindow with sql statements from current template definition

 

dw_2.replacetemplatefields()

dw_2.retrieve

transaction

 

x

 

Address different data sources (only via ODBC) with the transaction system.

First, initialize the transaction system.

dw_1.transaktion.init

 

init

Initialize

dsn

DSN Connect string

userid


dbpass


dbparm


servername


dsn


connect

Connect

disconnect

Disconnect. This command must be used.

settransobject

Set transaction to the DataWindow.

destroy

Destroy.

select

Execute a Select SQL statement with this transaction.

delete

Execute a Delete SQL statement with this transaction.

update

Execute a Update SQL statement with this transaction.

execute

Execute the SQL statement with this transaction.

blobread

 

blobread=nr  

Reads a blob. The blob name will be returned.

More informations see blobread.

blobwrite

blobwrite=nr=file  

Writes a blob. If "nr=leer" then it is a new entry.

It will return "nr". More informations see blobwrite.

 

This script needs to be applied in "Before retrieve"

dw_1.transaktion=init

dw_1.transaktion=dbparm=myodbcdrive;uid=myuser;pwd=mypwd

dw_1.transaktion=connect

dw_1.transaktion=settransobject

Also make sure that the connection is destroyed,  especially for an external data source.

This script needs to be applied in "after retrieve"

dw_1.transaktion=disconnect

 

The connection is initialized the next time the form is used.

If you use a multi tab  form, destroy the connection on each tab selection.

 

If the window consists of several tabs, the connection object should be destroyed when the tab is changed:

dw_1.transaktion=disconnect

dw_1.transaktion=destroy

 

type

x

 

 

<dw_2.type> returns the type of window

The available return values are:

browse

edit

Grid windows and multiline edit windows are "browse" windows, all other windows are edit windows.

 

Set this with:

dw_x.design=..

 

dw_x.is_type

update

 

x

Updates changes from DataWindow to current Database or Source, which is connected to the Datawindow (see the dw_x.transaction property).

udf

 

 

 

define the link to udf name

Example for QC Sample:

 

dw_2.udf= qssudf

 

The system make the related udf1-4 fields visible and set all format properties automatically

Must be before form.opened event.

 

if name of target field is not "udf" then you must define this with udfcol

 

dw_2.udfcol=beas_qc_order_udf

 

 

udfcol

 

 

Define target UDF Fields, if not same as udf name

verticalscrollposition

x

 

Returns the vertical scroll position.

verticalscrollposition=y

 

x

Sets the vertical scroll position.

In the (function) verticalscrollposition event the position can be set to 0 to disable the scroll functionality for this window (only dw_1).

global function verticalscroll

dw_1.verticalscrollposition=0

end global

visible=true/false

x

x

 

True = 1/j/y/t ...

 

Example:

dw_2.visible=true

messagebox=<dw_2.visible>

 

Attention: Do not make dw_1 invisible.

 

vscrollbar=true/false

 

 

Vertical scrollbar

verticalscroll=tru/false

 

x

Enables/disables the vertical scroll. If you insert a ue_tab or ue_code_editor, the vertical scroll is automatically disabled.

where1, where2, where3

x

 

The current SQL filter, which is active in the dw_1 formula.

x,y,width,height

x

x

hmtoggle_plus0Coordinate of data window

Changes / reads the coordinate of data window

 

Special position

min: set the minimal position for x and y, example: dw_1.x=min

max: set the maximal value for width and height, example: dw_1.width=max

 

Events

Event Name

Description

delete

Before line deleted

deleted

after line deleted

doubleclick

mouse left double click

inserted

after inserted new line

itemchanged

after changed an item

load

after loading / retrieve the datawindow

rightclick

mouse right lick

rowfocuschange

before row change

rowfocuschanged

after row change

update

while update datawindow (direct sql update)

updated

after update datawindow (direct sql update)