Obtains the value of an item in a value list or code table associated with a column in a DataWindow.
string dwcontrol.GetValue ( string column, integer index )
string dwcontrol.GetValue ( integer column, integer index )
Argument |
Description |
---|---|
dwcontrol |
A reference to a DataWindow control, DataStore, or child DataWindow. |
column |
The column for which you want the item. Column can be a column number (integer) or a column name (string). |
index |
The number of the item in the value list or the code table for the edit style. |
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:
displayvalue[tab]codevalue
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, the method returns NULL.
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 PocketBuilder, search for ~t.
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):
string Status
Status = dw_employee.GetValue(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:
string ls_prodinfo, ls_prodname, ls_prodnum
integer li_tab
ls_prodinfo = dw_employee.GetValue("product", 2)
li_tab = Pos(ls_prodinfo, "~t", 1)
ls_prodname = Left(ls_prodinfo, li_tab - 1)
ls_prodnum = Mid(ls_prodinfo, li_tab + 1)
Copyright © 2004. Sybase Inc. All rights reserved. |
![]() |