1. Clarence Chamorro
  2. PowerServer 2020 or older (Obsolete)
  3. Thursday, 3 November 2022 17:37 PM UTC

I have a datawindow with a dropdowndatawindow (datawindowchild). I want to change the dataobject of the dropdowndatawindow base on if their is some data in a table. I try the following but PowerBuilder tells me invalid property.

//cch declare the datawindowchild

DataWindowChild dwc_eeo

 

//cch get the datawindowchild from the datawindow

dw_1.GetChild("eeo_code", dwc_eeo)

//cch trying to change dataobject to the dwc
dwc_eeo.dataobject = 'd_test'     (Incompatible Property dataobject for type datawindowchild)
dwc_eeo.SetTransObject(sqlca)

//CCH CALL THE PFC_POPULATEDDDW
dw_1.event pfc_populatedddw( 'eeo_code',dwc_eeo)

 

We are using Appeon PowerBuilder 2019 R3 Build 2728.

 

Any advise would be greatly appreciated.

 

Regards,

 

Clarence.

mike S Accepted Answer Pending Moderation
  1. Thursday, 3 November 2022 17:48 PM UTC
  2. PowerServer 2020 or older (Obsolete)
  3. # 1

change the datawindow on the column

dw_1.modify("eeo_code.dddw_name='d_test' ")

Comment
There are no comments made yet.
John Fauss Accepted Answer Pending Moderation
  1. Thursday, 3 November 2022 18:09 PM UTC
  2. PowerServer 2020 or older (Obsolete)
  3. # 2

To add to Mike's answer...

You can alternatively use dot-notation:

dw_1.Object.eeo_code.DDDW.Name = 'd_test'

Using Modify has the advantage that the name of the column using the DDDW edit style can be assigned at run time, which is not the case when using dot-notation.

You may need to also change the names assigned to the DisplayColumn and DataColumn properties:

dw_1.Object.eeo_code.DDDW.DisplayColumn = 'xxxxx'
dw_1.Object.eeo_code.DDDW.DataColumn = 'yyyyy'

Using Modify, you can change all three properties (and more) in a single function call:

dw_1.Modify("eeo_code.DDDW.Name='d_test' eeo_code.DDDW.DisplayColumn='xxxxx' eeo_code.DDDW.DataColumn='yyyyy'")

as long as you separate each property change with a space, as shown above.

Best regards, John

Comment
There are no comments made yet.
Roland Smith Accepted Answer Pending Moderation
  1. Thursday, 3 November 2022 20:10 PM UTC
  2. PowerServer 2020 or older (Obsolete)
  3. # 3

If none of these suggestions work, you might be able get the source of the main datawindow with LibraryExport, change the property with Replace, and then reapply the new syntax with dw_1.Create.

Comment
There are no comments made yet.
Miguel Leeuwe Accepted Answer Pending Moderation
  1. Thursday, 3 November 2022 20:12 PM UTC
  2. PowerServer 2020 or older (Obsolete)
  3. # 4

Apart from the great solutions provided here by our gurus, I'd like to add that to be honest, it should be perfectly possible to do what Clarence tried to do in the first place. Why is dwchild still so limited after so many years?

regards.

Comment
There are no comments made yet.
Clarence Chamorro Accepted Answer Pending Moderation
  1. Thursday, 3 November 2022 21:07 PM UTC
  2. PowerServer 2020 or older (Obsolete)
  3. # 5

After Following very good advises I place this code in the postopen event. When It execute the 2.-Part the column b_p_phase_code disappear from the datawindow. Any advise?

This is the actual code in the PostOpen Event of the window.

//cch check if project has phases 1.- Part
If uf_check_if_bidproj_has_phases( ll_bidprojcode) Then
  Datawindowchild dwc_phase1
  dw_1.GetChild('b_p_phase_code', dwc_phase1)
  dw_1.Modify("b_p_phase_code.DDDW.Name='ddw_bid_phase_code_list_per_bidproj' b_p_phase_code.DDDW.DisplayColumn='b_p_phase_descrip'     b_p_phase_code.DDDW.DataColumn='b_p_phase_code'")
  dwc_phase1.SetTransobject(sqlca)
  ll_rows = dwc_phase1.Retrieve( ll_bidprojcode)

Else   // 2.- Part

  Datawindowchild dwc_phase
  dw_1.GetChild('b_p_phase_code',dwc_phase)
  dw_1.Modify("b_p_phase_code.DDDW.Name='ddw_bid_phase_code_list' b_p_phase_code.DDDW.DisplayColumn='b_p_phase_descrip'       b_p_phase_code.DDDW.DataColumn='b_p_phase_code'")
  //cch open channel with database
  dwc_phase.SetTransobject(sqlca)
  dwc_phase.Retrieve()

End If

 

Regards,

 

Clarence

Comment
  1. mike S
  2. Thursday, 3 November 2022 21:35 PM UTC
getchild has to be AFTER you change the dddw
  1. Helpful
  1. John Fauss
  2. Friday, 4 November 2022 00:03 AM UTC
I thought so, also, Mike. In my testing earlier today, I found that the DataWindowChild object does NOT become invalid after setting a new DDDW Name, DisplayColumn and/or DataColumn, which surprised my greatly!

Even though it works as Clarence has it coded, I would still call GetChild() AFTER modifying the DDDW properties, as you point out.



Great to learn you were able to get your issue working, Clarence!
  1. Helpful
There are no comments made yet.
Clarence Chamorro Accepted Answer Pending Moderation
  1. Thursday, 3 November 2022 22:00 PM UTC
  2. PowerServer 2020 or older (Obsolete)
  3. # 6

Sorry guys.

I had a function running in the visible property that made the field visible = false.

I am still working on my issue.

Let you know how I solve it.

Regards,

Clarence

Comment
There are no comments made yet.
Clarence Chamorro Accepted Answer Pending Moderation
  1. Thursday, 3 November 2022 22:37 PM UTC
  2. PowerServer 2020 or older (Obsolete)
  3. # 7

It did work perfect.

Thank you guys.

 

Regards,

 

Clarence.

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.