1. Hirenkumar Lad
  2. PowerBuilder
  3. Monday, 9 May 2022 12:54 PM UTC

Dear Support Team,

I want to Fill the dropdown Items from database table with their respective Primary key value. E.g. There is a Table in database having Id and Display Text columns. I will fetch the records from Table and fill the dropdown with Display Text column's value. But I want to map the display text column's value with the Id column. So that whenever I will select any Display Text Value, I can get the respective Id value for the selected Item.

Can I achieve this behavior in Power Builder? If so then please suggest me the solution.

Thanks & Regards,

Hiren Lad

 

René Ullrich Accepted Answer Pending Moderation
  1. Monday, 9 May 2022 13:29 PM UTC
  2. PowerBuilder
  3. # 1

Hi,

this sounds like you want to use the DropDownDatawindow edit style.

You have to define a second datawindow that selects the ids and display values from the database. You can design it like you want.

In your edit datawindow use the edit style DropDownDatawindow for the column. Specify the second datawindow and select the columns you want to use as data column (the id) and display column (the text). If the dropdown datawindow have no retrieval arguments you can retrieve it automatically ("Auto retrieve" option). If you need retrieval arguments you have to write a small piece of code.

There are some traps:

- The dropdown values are the same for all rows in the datawindow. (It is more complicated if you need row-depended dropdowns.)

- Also the display value must be unique in the drop down list (or it may not work correctly)! (If not create a computed columns as display column that contains the text and the id).

HTH to start,

René

 

Comment
There are no comments made yet.
John Fauss Accepted Answer Pending Moderation
  1. Monday, 9 May 2022 13:24 PM UTC
  2. PowerBuilder
  3. # 2

Greetings, Hiren - 

This is precisely what the Drop-Down DataWindow (DDDW) edit style of a column object in a DataWindow does. It is one of the most powerful and flexible features of PowerBuilder.

If you are relatively new to PowerBuilder development, I suggest you consider looking into the free courses available in Appeon-U, particularly the PowerBuilder Fundamentals Course.

   https://www.appeon.com/appeon-u

Best regards, John

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.