1. Michał Misijuk
  2. PowerBuilder
  3. Monday, 12 August 2019 08:10 AM UTC

Hi.
I have a datawindow. One of columns is DropDownDW - in display column is symbol, and data column - id. Works perfectly.

problem is that i have to update foreign keys (composite) to another table which looks like:

table_A.method_id = table_B.id AND table_a.method_v = table_b.v

and in dropdownDW i have only id value (used in "data column" property).
Is there a possibility to pass this additional column value? 
Like add this second column to DDDW, or use dw.setItem function?

Or is there better approach?

Accepted Answer
René Ullrich Accepted Answer Pending Moderation
  1. Monday, 12 August 2019 13:40 PM UTC
  2. PowerBuilder
  3. # Permalink

Hi Michał,

I think there is not automatic way.

What I have done in a similar case:

Also retrieve the addition column in your datawindow that you use for update. You don't need to show it.

You may also provide the value for the additional column in the datawindow that you use for DDDW.

Use the DDDW in the same way you already have. But remember that the column value should be unique! Powerbuilder selects the first matching item if it opens the DDDW.

In the itemchanged Event you can add the value for the additional column. You may get it from the DDDW.

e.g.

        IF getchild ("mycolumn", ldwc_dddw) > 0 THEN
            ll_row = ldwc_dddw.Find ("mydatacolumn='" + data + "'", 1, ldwc_dddw.RowCount ())
            IF ll_row< 1 THEN return 1
            SetItem (row, "myadditionalcolumn", ldwc_dddw.GetItemXXX (ll_row, "myadditionaldatacolumn"))
        END IF

HTH,

René

Comment
  1. Michał Misijuk
  2. Tuesday, 13 August 2019 09:17 AM UTC
Hello René,

I need help, since I'am a little bit newbie in PB

I have datawindow (dw_data) which contains dddw,

so i declared

datawindowchild ldwc



DDDW contains 4 columns:

symbol(display column),

name,

id (data column),

v (what i need)



this line: dw_data.getchild("id",ldwc) > 0 gives me -1



Did i miss something?
  1. Helpful
  1. René Ullrich
  2. Tuesday, 13 August 2019 09:21 AM UTC
Hi Michał,

getChild function is to get the child of your column in dw_data. Specify the column that have the DDDW assigned.

  1. Helpful
  1. Michał Misijuk
  2. Tuesday, 13 August 2019 10:43 AM UTC
Thanks Again! You are my savior today!
  1. Helpful
There are no comments made yet.
Olan Knight Accepted Answer Pending Moderation
  1. Monday, 12 August 2019 21:45 PM UTC
  2. PowerBuilder
  3. # 1

I'll second what Renee said, but you could display the value by changing the DDDW to include a new STRING column of "displayData" defined as a varchar() which shows the "original_value + "  + "additional_column".

Olan

 

Comment
  1. Georg Brodbeck
  2. Tuesday, 13 August 2019 10:26 AM UTC
You could even add a computed field to the DDDW (and hide it removing the "visible"-flag) and select that as display value.
  1. Helpful
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.
We use cookies which are necessary for the proper functioning of our websites. We also use cookies to analyze our traffic, improve your experience and provide social media features. If you continue to use this site, you consent to our use of cookies.