amollsde
asked on
How to retrieve data from the selected row from a Dropdown DataWindow
I have the following lines of code:
string ls_school_name
integer li_school_code
li_school_code = dw_school.GetItemNumber(dw _school.Ge tRow(),'sc hool_code' )
ls_school_name = dw_school.GetItemString(dw _school.Ge tRow(),'sc hool_name' )
The problem is the when I issue the GetRow() function, it always returns 1. How do I get it to return the ROW that the user selected in the DropDown Datawindow?
dw_school is the name of the datawindow control that contains the dropdown data window. Also, when I use the function dw_school.GetSelectedRow(0 ) it returns 0, even though the user has selected an item in the dropdown datawindow. Do I need to reference the DataWindow Child somehow, and if so how?
Another peculiarity is that when I specify:
li_school_code = dw_school.GetItemNumber(1, 'school_co de')
It returns the school code value for the item the user "selected", but not the value for ROW 1, as it should. School Code is defined as the DataColumn. If I issue the same function but for a string which is defined as the DisplayColumn, then I don't get the school name the user selected but the correct name for that Row, for Row one, which is what should be returned. Is this a bug with PowerBuilder 6.5?
string ls_school_name
integer li_school_code
li_school_code = dw_school.GetItemNumber(dw
ls_school_name = dw_school.GetItemString(dw
The problem is the when I issue the GetRow() function, it always returns 1. How do I get it to return the ROW that the user selected in the DropDown Datawindow?
dw_school is the name of the datawindow control that contains the dropdown data window. Also, when I use the function dw_school.GetSelectedRow(0
Another peculiarity is that when I specify:
li_school_code = dw_school.GetItemNumber(1,
It returns the school code value for the item the user "selected", but not the value for ROW 1, as it should. School Code is defined as the DataColumn. If I issue the same function but for a string which is defined as the DisplayColumn, then I don't get the school name the user selected but the correct name for that Row, for Row one, which is what should be returned. Is this a bug with PowerBuilder 6.5?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Lev,
Thank you, thank you, thank you! You've been a lifesaver. This is the second, VERY precise answer you've given me. I really appreciate your clarity when responding. I've aways been able to take your solution, make a slight modification to my script and it's worked everytime.
I really appreciate it!
Alecia
Thank you, thank you, thank you! You've been a lifesaver. This is the second, VERY precise answer you've given me. I really appreciate your clarity when responding. I've aways been able to take your solution, make a slight modification to my script and it's worked everytime.
I really appreciate it!
Alecia
Use GetChild() funtion to get the display value.
//Declare variable (Instance or Local up to you)
Datawindowchild ldwc_child
dw_1.GetChild("column_name
ldwc_child.SetTransObject(
//You can retrieve the ldwc_child
ldwc_child.Retrieve()
//REMEMBER do not declare the retrieve values for child-datawindow.
ldwc_child.GetItemString(l
//Name of the column have the string value
Which datawindow you want to retrieve after getting the value from dropdowndatawindow?
Please let me know to solve it .
Best regards
Bhatti