value

Read or change the value from an item

Available as property and Method

 

Read and write with property item.value

 

write value with

dw_1.items.mycolumn.value="hello world";

Beas will convert the argument always in the item type

 

Example:

// myColumn = type "String"
dw_1.items.mycolumn.value=5; // insert "5" in the column as text

 

read a value

alert(dw_1.items.itemcode.value);

 

The value return always the value from the item as type of the item (string, number or datetime)

It's possible to convert directly to another format

alert(items.onhand.value.toString(items.invntryuom.value)) // return example 2.00 Pieces

 

if value is null, the system convert this to a default value:

NULL-String = "", NULL-Number=0, NULL-Datetime="1990/01/01 00:00"

 

Read from specific row

value property return always the value from current row. You can change this with dw_1.setrow(newRow);

or you define the row after item name

let line=5;

alert(dw_1.items.itemcode[line].value);

 

Example: Read a value from all rows and add to a string
for (line in dw_1)
    text += col[line].value+" ";
alert(text);

 

Read with method value()

 

The method value() deliver additional functionality for NULL and Empty handling

All parameters are optional.

 

let s=item.value(defaultValue as string, replaceEmpty as boolean);

 

defaultValue: (any) This is the value, which the system return, if item value is null or empty

replaceEmpty: (boolean) if true, then it use defaultValue, if string is empty or null, otherwise only if null

 

 

Example item List

items.itemcode.setnull() // set value to null
alert(items.itemcode.value()); // return empty string 
alert(items.itemcode.value("- not defined -"); // return "- not defined -"
 
items.itemcode.value=""; // make empty, but not null
alert(items.itemcode.value()); // return empty string 
alert(items.itemcode.value("- not defined -"); // return empty string, because not null
alert(items.itemcode.value("- not defined -",true); // return "- not defined -"

 

replaceEmpty - Data Types:

 

Item Type

return defaultValue, if value is ...

string

NULL or trim(value)=""

number

NULL or value=0

datetime

NULL or year <= 1990