GetValue method (DataWindows)
Description
Obtains the value of an item in a value list or code table
associated with a column in a DataWindow.
A separate method name is provided as an alternative syntax
for the Web DataWindow server component, which cannot use overloaded
methods.
Controls
DataWindow type |
Method applies to |
---|---|
PowerBuilder |
DataWindow control, DataWindowChild object, DataStore |
Web |
Server component |
Web ActiveX |
DataWindow control, DataWindowChild object |
Syntax
[PowerBuilder]
1 |
string <span>dwcontrol</span>.<span>GetValue</span> ( string <span>column</span>, integer <span>index</span> )<br>string <span>dwcontrol</span>.<span>GetValue</span> ( integer <span>column</span>, integer <span>index</span> ) |
[Web DataWindow server component]
1 |
string <span>dwcontrol</span>.<span>GetValue</span> ( string <span>column</span>, short <span>index</span> )<br>string <span>dwcontrol</span>.<span>GetValueByColNum</span> ( short <span>column</span>, short <span>index</span> ) |
[Web ActiveX]
1 |
string <span>dwcontrol</span>.<span>GetValue</span> ( string <span>column</span>, number <span>index</span> )<br>string <span>dwcontrol</span>.<span>GetValue</span> ( number <span>column</span>, number <span>index</span> ) |
Argument |
Description |
---|---|
dwcontrol |
A reference to a DataWindow control, |
column |
The column for which you want the item. Column can |
index |
The number of the item in the value list |
Return Values
Returns the item identified by index in
the value list or the code table associated with column of dwcontrol.
If the item has a display value that is not the actual value, GetValue
returns a tab-separated string consisting of:
1 |
<span>displayvalue</span>[tab]<span>codevalue</span> |
Returns the empty string (” “) if the index
is not valid or the column does not have a value list or code table.
If any argument value is null, in PowerBuilder and JavaScript
the method returns null.
Usage
You can use GetValue to find out the values
associated with the following edit styles: CheckBox, RadioButton,
DropDownListBox, Edit Mask, and Edit. If the edit style has a code
table in which each value in the list has a display value and a
data value, GetValue reports both values.
GetValue does not get values from a DropDownDataWindow code
table.
You can parse the return value by searching for the tab character
(ASCII 09). In PowerBuilder, search for ~t.
Examples
If the value list for column 7 of dw_employee
contains Full Time, Part Time, Retired, and Terminated, these statements
return the value of item 3 (Retired):
1 |
string Status |
1 |
Status = dw_employee.<span>GetValue</span>(7,3) |
If the value list for the column named product of
dw_employee is Widget[tab]1, Gadget[tab]2,
the following code returns Gadget[tab]2 and saves
the display value in a string variable:
1 |
string ls_prodinfo, ls_prodname, ls_prodnum |
1 |
integer li_tab |
1 |
1 |
ls_prodinfo = dw_employee.<span>GetValue</span>("product", 2) |
1 |
1 |
li_tab = Pos(ls_prodinfo, "~t", 1) |
1 |
ls_prodname = Left(ls_prodinfo, li_tab - 1) |
1 |
ls_prodnum = Mid(ls_prodinfo, li_tab + 1) |