Hi!!!
I'm following the guide to download files onDemand in a table, you can find that guide at:
If found a problem with the guide: What would happen if there's an error while downloading or somenthing else? There the author doesn't explain how to show an error in the view.
What I'd like to do is to show a error message in the view where the table is.
I tried to add some code, but it doesn't finally show the error message.
I have a method that generates the file and returns the path of the file in the context, so I can read it. It return boolean (true if the file was generated, false on the contray). That method is called executeZgav_Sf_Formulario_Sv_Input(nroEmpleado, nroViaje, morei, datosEspejo); and is working fine.
I also have a static class that reads a file and returns the byte[] called: ManejoArchivos.getByteArrayFromResourcePath(wdContext.currentOutput_FormularioSVElement().getP_Path(), true);
But if for example, the parameters are incorrect and the file cannot be generated, the method is supposed to show an error but is not displayed on the screen.
I have some code after that which validates if the file could be read or not and returns the bytes of a prewritten PDF file with an error message.
-
Added code:
byte[] r = null;
boolean continuar =
this.executeZgav_Sf_Formulario_Sv_Input(nroEmpleado, nroViaje, morei, datosEspejo);
if (continuar)
try {
r =
ManejoArchivos.getByteArrayFromResourcePath(
wdContext.currentOutput_FormularioSVElement().getP_Path(),
true);
} catch (FileNotFoundException e) {
wdComponentAPI.getMessageManager().reportMessage(
IMessageData.ARCHIVO_NO_ENCONTRADO,
null,
true);
} catch (IOException e) {
wdComponentAPI.getMessageManager().reportMessage(IMessageData.PROBLEMA_IO, null, true);
}