Código de Power Builder - Campos con estilo DropDownDataWindow relacionados

sin imagen de perfil

Campos con estilo DropDownDataWindow relacionadosgráfica de visualizaciones


Power Builder

Publicado el 28 de Enero del 2003 por Victor Arreola (5 códigos)
30.038 visualizaciones desde el 28 de Enero del 2003
DropDownDataWindow relacionadas. (DropDownDataWindow=dddw)
Si en el campo ciudad.dddw se selecciona la clave 2500, que el campo colonia.dddw solo presente colonias de la ciudad 2500.
Actualmente los dddw solo pueden ser relacionados a un campo, falta poder CONDICIONAR por 1 o mas valores para casos especificos donde la informacion va de clasificada en capas.

Versión 1
estrellaestrellaestrellaestrellaestrella(1)

Publicado el 28 de Enero del 2003gráfica de visualizaciones de la versión: Versión 1
30.039 visualizaciones desde el 28 de Enero del 2003
estrellaestrellaestrellaestrellaestrella
estrellaestrellaestrellaestrella
estrellaestrellaestrella
estrellaestrella
estrella

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
/************************* Funcion#05  *************************************
Funcion PB: Campos con estilo DropDownDataWindow relacionados.
Comentario: DropDownDataWindow relacionadas. (DropDownDataWindow=dddw)
            Si en el campo ciudad.dddw se selecciona la clave 2500, que
            el campo colonia.dddw solo presente colonias de la ciudad 2500.
            Actualmente los dddw solo pueden ser relacionados a un campo,
            falta poder CONDICIONAR por 1 o mas valores para casos
especificos
            donde la informacion va de clasificada en capas.
            (ciudad>>>>>>>calles)
            (carrera>>>grupos>>>alunmos)
            (bibliotecas>>>>seccion>>>>materia>>>libro)
            (bibliotecas>>>>autor>>>libro)
Autor   : Lic. Victor Arreola //:-)
Sintaxis: Ponganse en los Eventos indicados.
**************************************************************************/
SQL de DW_captura: select clave_alumno,nombre,cve_poblacion_id,cve_calle_id
from alumno
SQL de DropDownDataWindow: select cve_poblacion_id,nom_poblacion from
ca_poblacion
SQL de DropDownDataWindow y dwc_calles : select
cve_poblacion_id,cve_calle_id,nom_calle from ca_calles
---------------------------------------------------------------------------
A una W_ventana ponga una DW_captura
 
--------------------------------------------------------------------------
DECLARE INSTANCE/INSTANCIAS VARIABLES
DataWindowChild dwc_calles
string is_sql_calles
 
////////////W_ventana en evento Open /////////
 
dw_captura.SetTransObject(SQLCA) //DW principal
 
dw_captura.GetChild("cve_calle_id", dwc_calles) //Coneccion del campo de
dddw
 
dwc_calles.SetTransObject(SQLCA) //DW hija
 
is_sql_calles = dwc_calles.Describe("DataWindow.Table.Select") //Lectura del
SQL de DWHIJA
 
//EL dddw DE POBLACIONES NO REQUIERE SER dw_hija.
 
///////////DW_captura en evento RetrieveEnd/////////////
// AL HACER EL RETRIEVE INICIAL O POSTERIORES EL LISTADO DE CALLES ESTARA
// CORRECTAMENTE CONDICIONADO.
////////////////////////////////////////////////////////
 
string ls_domicilio='',ls_letra=''
long ll_num_int=0,ll_pobl=0
long ll_calle=0,ll_reg_existe=0
string rc, mod_string
constant string where_clause=' WHERE ca_calles.cve_poblacion_id = '
 
if rowcount>0 then RETURN
 
	ll_pobl=dw_captura.GetItemNumber(1,'cve_poblacion_id') //SE EVALUA LA
INFORMACION DEL 1ER REGISTRO.
 
	if isnull(ll_pobl) then ll_pobl=0
 
if ll_pobl<>0 then  // si la clave de poblacion es cero no se captura calle.
 
mod_string =
"DataWindow.Table.Select='"+is_sql_calles+where_clause+string(ll_pobl)+"'"
////////Calle
	ll_calle=dw_captura.GetItemNumber(1,'cve_calle_id')
 
rc = dwc_calles.Modify(mod_string)
 
IF rc <> "" THEN
MessageBox("Error", "No se puede hacer la relacion Poblaciones-Calles~r"
+ rc)
END IF
dwc_calles.SetTransObject(SQLCA)
if dwc_calles.Retrieve()>0 then
ll_reg_existe= dwc_calles.Find( "cve_calle_id = "+string(ll_calle),1,
dwc_calles.RowCount())
if isnull(ll_reg_existe) or ll_reg_existe<=0 then
	ll_calle= dwc_calles.GetItemNumber(1,'cve_calle_id')
dw_captura.SetItem(1,'cve_calle_id', ll_calle )
else
	dwc_calles.SetRow( ll_reg_existe )
end if
else
dw_captura.SetItem(1,'cve_calle_id', 0 )
end if
 
//////// DW_captura en evento ItemChanged//////////////
//CADA VEZ QUE SE CAMBIE LA POBLACION SE CONDICIONAN NUEVAMENTE LAS CALLES.
///////////////////////////////////////////////////////
 
if row>0 then RETURN
if dwo.name='cve_poblacion_id' and long(data)<>0 then
	long ll_pob=0,ll_calle=0,ll_reg_existe=0
	string rc, mod_string
	constant string where_clause=' WHERE ca_calles.cve_poblacion_id = '
 
	ll_pob  =long(data)
	if isnull(ll_pob) then ll_pob=0
 
	mod_string = "DataWindow.Table.Select='"+is_sql_calles+where_clause+string(ll_pob)+"'"
	////Calle
	ll_calle=dw_captura.GetItemNumber(row,'cve_calle_id')
 
	rc = dwc_calles.Modify(mod_string)
 
IF rc <> "" THEN
	MessageBox("Error", "No se puede hacer la relacion Poblaciones-Calles~r" + rc)
END IF
dwc_calles.SetTransObject(SQLCA)
if dwc_calles.Retrieve()>0 then
ll_reg_existe= dwc_calles.Find( "cve_calle_id = "+string(ll_calle),1,
dwc_calles.RowCount())
if isnull(ll_reg_existe) or ll_reg_existe<=0 then
	ll_calle= dwc_calles.GetItemNumber(1,'cve_calle_id')
dw_captura.SetItem(row,'cve_calle_id', ll_calle )
else
	dwc_calles.SetRow( ll_reg_existe )
end if
else
dw_captura.SetItem(row,'cve_calle_id', 0 )
end if
 
////////DW_captura en evento ItemFocusChanged////////
//CADA VEZ QUE PIERDE EL FOCO LA POBLACION SE CONDICIONAN NUEVAMENTE LAS
CALLES.
// ESTO ES UTIL CUANDO SE NAVEGA SOLO CON MOUSE (SIN TAB).
///////////////////////////////////////////////////
if row>0 then RETURN
if dwo.name='cve_poblacion_id' and
dw_captura.GetItemNumber(row,'cve_poblacion_id')<>0 then
	long ll_pob=0,ll_calle=0,ll_reg_existe=0
	string rc, mod_string
	constant string where_clause=' WHERE ca_calles.cve_poblacion_id = '
	ll_pob  =dw_captura.GetItemNumber(row,'cve_poblacion_id')
	if isnull(ll_pob) then ll_pob=0
mod_string = "DataWindow.Table.Select='"+is_sql_calles+where_clause+string(ll_pob)+"'"
	/////Calle
	ll_calle=dw_captura.GetItemNumber(row,'cve_calle_id')
rc = dwc_calles.Modify(mod_string)
 
IF rc <> "" THEN
MessageBox("Error", "No se puede hacer la relacion Poblaciones-Calles~r"
+ rc)
END IF
 
dwc_calles.SetTransObject(SQLCA)
if dwc_calles.Retrieve()>0 then
ll_reg_existe= dwc_calles.Find( "cve_calle_id = "+string(ll_calle),1,
dwc_calles.RowCount())
if isnull(ll_reg_existe) or ll_reg_existe<=0 then
	ll_calle= dwc_calles.GetItemNumber(1,'cve_calle_id')
	dw_captura.SetItem(row,'cve_calle_id', ll_calle )
else
	dwc_calles.SetRow( ll_reg_existe )
end if
else
	dw_captura.SetItem(row,'cve_calle_id', 0 )
end if
///////////////////////////////////////////////////////////
/*eof F05. */



Comentarios sobre la versión: Versión 1 (1)

24 de Octubre del 2018
estrellaestrellaestrellaestrellaestrella
Excelente, me ayuda mucho.
Responder

Comentar la versión: Versión 1

Nombre
Correo (no se visualiza en la web)
Valoración
Comentarios...
CerrarCerrar
CerrarCerrar
Cerrar

Tienes que ser un usuario registrado para poder insertar imágenes, archivos y/o videos.

Puedes registrarte o validarte desde aquí.

Codigo
Negrita
Subrayado
Tachado
Cursiva
Insertar enlace
Imagen externa
Emoticon
Tabular
Centrar
Titulo
Linea
Disminuir
Aumentar
Vista preliminar
sonreir
dientes
lengua
guiño
enfadado
confundido
llorar
avergonzado
sorprendido
triste
sol
estrella
jarra
camara
taza de cafe
email
beso
bombilla
amor
mal
bien
Es necesario revisar y aceptar las políticas de privacidad

http://lwp-l.com/s503