1. Reynard Harrison
  2. PowerBuilder
  3. Wednesday, 19 July 2023 16:11 PM UTC

is this possible I am using a drop-down list box in a data window. How can I retrieve my data value which is also coming in from XML doc and get the display value in a variable?

 

 

 

Attachments (1)
Who is viewing this page
Accepted Answer
Reynard Harrison Accepted Answer Pending Moderation
  1. Wednesday, 19 July 2023 17:45 PM UTC
  2. PowerBuilder
  3. # Permalink

Thank you John I think what I am asking is not possible I really want to pass the data value to the drop-down datawindow list box and get the display value. I think I have to use a two dimension array or create a table in the database.

Comment
  1. Roland Smith
  2. Wednesday, 19 July 2023 18:49 PM UTC
This will return the code table for a ddlb:



dw_control.Object.columnname.Values



The format of the string is the same as the datawindow source:



displayvalue1 tab datavalue1 forwardslash displayvalue2 tab datavalue2 forwardslash displayvalue3 tab datavalue forwardslash3
  1. Helpful 2
  1. Mark Goldsmith
  2. Wednesday, 19 July 2023 18:58 PM UTC
Exactly...and if you want to pull out a single value and know the index I'm thinking GetValue() should do the trick.
  1. Helpful
There are no comments made yet.
John Fauss Accepted Answer Pending Moderation
  1. Wednesday, 19 July 2023 17:34 PM UTC
  2. PowerBuilder
  3. # 1

Hi, Reynard -

To obtain the data value, obtain it via the GetItemString function. For example:

Long ll_row
String ls_data

ll_row = dw_1.GetRow()
If ll_row < 1 or ll_row > dw_1.RowCount() Then
   MessageBox("Error","Select a row first, please.")
   Return 0
End If

ls_data = dw_1.GetItemString(ll_row,"charge_type_codes")

MessageBox('Data Value','The data value in row '+String(ll_row)+' is "'+ls_data+'".')
Return 0

To obtain the display value of the selected option from the drop-down list box, Use the Evaluate expression in a Describe function:

Long ll_row
String ls_describe, ls_display

ll_row = dw_1.GetRow()
If ll_row < 1 or ll_row > dw_1.RowCount() Then
   MessageBox("Error","Select a row first, please.")
   Return 0
End If

ls_describe = "Evaluate('LookUpDisplay(charge_type_codes)'," + String(ll_row) + ")"
ls_display = dw_1.Describe(ls_describe)

MessageBox('Display Value','The display value in row '+String(ll_row)+' is "'+ls_display+'".')
Return 0

Best regards, John

Comment
  1. Chris Pollach @Appeon
  2. Wednesday, 19 July 2023 18:18 PM UTC
Yep .. the "LookupDisplay" command would do it! ;-)
  1. Helpful
There are no comments made yet.
Reynard Harrison Accepted Answer Pending Moderation
  1. Wednesday, 19 July 2023 17:30 PM UTC
  2. PowerBuilder
  3. # 2

this is in a PowerBuilder 2022 application

Comment
There are no comments made yet.
Reynard Harrison Accepted Answer Pending Moderation
  1. Wednesday, 19 July 2023 17:29 PM UTC
  2. PowerBuilder
  3. # 3

Who is viewing this page?  What do you mean?

Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.