on 09-04-2016 11:00 AM
Hi experts
I have 2 tables in a database postgresql:
Tipo_Pago
id_tipo_pago integer (PK)
nom_tipo_pago varchar(50)
Forma_Pago
id_forma_pago integer (PK)
id_tipo_pago integer (FK)
nom_forma_pago
Tipo_Pago contains:
1 | CONTADO
2 | CREDITO
Forma_Pago contains:
1 | 1 | EFECTIVO
2 | 2 | CREDITO A 15 DIAS
3 | 2 | CREDITO A 30 DIAS
4 | 2 | CREDITO A 60 DIAS
In a DW I have 2 fields:
1 - id_tipo_pag is associated with dddw_tipo_pago and Auto Retrieve = True
2 - id_forma_pago is associated with dddw_forma_pago and AutoRetrieve = False
In the event ItemChanged I have placed this code:
DataWindowChild ldwc_FormaPago
IF Not Row > 0 THEN RETURN
This.AcceptText()
CHOOSE CASE This.GetColumnName()
CASE 'id_tip_pag'
GetChild('id_for_pag', ldwc_FormaPago)
ldwc_FormaPago.SetTransObject(SQLCA)
ldwc_FormaPago.Retrieve(GetItemNumber(1, 'id_tip_pag'))
END CHOOSE
In the event RetrieveEnd I have placed this code:
IF NOT RowCount >0 THEN RETURN
DataWindowChild ldwc_FormaPago
GetChild('id_for_pag', ldwc_FormaPago)
ldwc_FormaPago.SetTransObject(SQLCA)
ldwc_FormaPago.Retrieve(GetItemNumber(1, 'id_tip_pag'))
At runtime:
If I select CREDITO and CREDITO A 15 DIAS
And then I decide to select CONTADO in the field Forma de Pago is displayed 2 that is code of CREDITO A 15 DIAS .
I'm missing in my code?
The DDDW only work with string?
The behavior of the dddws is correct. What you need to do is reset the second dddw (Forma de Pago) when changing the first dddw (Tipo de Pago) so that values from the previous selection that are not valid in the new selection get cleared.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Try setting it to null:
integer li_null
SetNull(li_null)
SetItem(row, 'id_for_pag', li_null)
The dddw combo consists of two controls, the drop down list populated with db values and the edit control which is linked to the main dw column. When the user selects an item from the dd list the value is copied to the edit control although it uses the dd list to display the description of the value, not the value itself. So if the dd list is changed because of a different argument sent to the dddw then the edit control won't display the correct description or won't find any description at all for that particular value so the control shows the plain value instead. A good practice is to reset the edit control by setting it to null since the old value selected by the user ceases to apply when the selection from the first dddw is changed.
User | Count |
---|---|
76 | |
9 | |
8 | |
7 | |
6 | |
5 | |
5 | |
5 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.