Power Builder - Validar ImportFile

 
Vista:

Validar ImportFile

Publicado por Guillermo (72 intervenciones) el 19/04/2007 14:06:56
Quisiera saber si en Power Builder hay algun comando que valide la importacion de archivos.
Lo que quiero hacer es algo asi:
If isvalid(dw_1.ImportFile("c:\archvio.txt")) then
dw_1.ImportFile("c:\archvio.txt")
else
no importar
end if

Muchas gracias!!!

Saludos!!!!
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

RE:Validar ImportFile

Publicado por Victor //:-) (116 intervenciones) el 25/04/2007 20:40:22
long ll_nro_registros_importados=0

ll_nro_registros_importados=dw_employee.ImportFile(Text!,"D:\TMP\EMPLOYEE.txt")

if ll_nro_registros_importados<=0 then
messagebox('error','no se pudo importar el archivo texto')
end if

recuerda:
la funcion devuelve datos tipo: Long. Returns the number of rows that were imported if it succeeds and one of the following negative integers if an error occurs:

Lo numero negativos significa errores:

-1 No rows or startrow value supplied is greater than the number of rows in the file
-2 Empty file
-3 Invalid argument
-4 Invalid input
-5 Could not open the file
-6 Could not close the file
-7 Error reading the text
-8 Unsupported file name suffix (must be *.txt, *.csv, *.dbf or *.xml)
-10 Unsupported dBase file format (not version 2 or 3)

-11 XML Parsing Error; XML parser libraries not found or XML not well formed
-12 XML Template does not exist or does not match the DataWindow
-13 Unsupported DataWindow style for import
-14 Error resolving DataWindow nesting
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

RE:Validar ImportFile

Publicado por Guillermo (72 intervenciones) el 26/04/2007 19:14:04
Estimado Victor, ya probe con esta opcion y no me funciona porque, al hacer:
ll_nro_registros_importados=dw_employee.ImportFile(Text!,"D:\TMP\EMPLOYEE.txt")
si el archivo EMPLOYEE.txt, no es archivo de texto valido para el datawindow dw_employee, se va al evento itemerroor del control datawindow y saca un error del datawindow y luego se va al:
if ll_nro_registros_importados<=0 then
messagebox('error','no se pudo importar el archivo texto')
end if
pero en ese momento ya no me sirve, porque ya me salto el error del datawindow, que es lo que yo quiero evitar, para poner yo mi propia validacion.
Muchas gracias,
Saludos,
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar