I'm trying to add tables to report using AddArray method. This work fine, but i found one problem. When table is empty, then there is no data and method calling is:
oTest := oFr:AddArray ("Test", {}, aStruc)
This call does not add the table in the report. For example, this produces an error:
oTest:SetMaster (...)
In order for this site to work correctly we need to store a small file (called a cookie) on your computer. Most every site in the world does this, however since the 25th of May 2011, by law we have to get your permission first. Please abandon the forum if you disagree.
Para que este foro funcione correctamente es necesario guardar un pequeño fichero (llamado cookie) en su ordenador. La mayoría de los sitios de Internet lo hacen, no obstante desde el 25 de Marzo de 2011 y por ley, necesitamos de su permiso con antelación. Abandone este foro si no está conforme.
Para que este foro funcione correctamente es necesario guardar un pequeño fichero (llamado cookie) en su ordenador. La mayoría de los sitios de Internet lo hacen, no obstante desde el 25 de Marzo de 2011 y por ley, necesitamos de su permiso con antelación. Abandone este foro si no está conforme.
AddArray
-
- Mensajes: 42
- Registrado: Sab Ago 10, 2013 2:39 am
- ignacio
- Site Admin
- Mensajes: 9257
- Registrado: Lun Abr 06, 2015 8:00 pm
- Ubicación: Madrid, Spain
- Contactar:
AddArray
nbatocanin escribió el mié, 19 noviembre 2014 02:53I'm trying to add tables to report using AddArray method. This work fine, but i found one problem. When table is empty, then there is no data and method calling is:
oTest := oFr:AddArray ("Test", {}, aStruc)
This call does not add the table in the report. For example, this produces an error:
oTest:SetMaster (...)
Obviously arrays should not be empty. But in any case you should get a valid oTest object. The sturcture of the array data should be equal to aStruc. So an empty array is not valid.
Regards,
oTest := oFr:AddArray ("Test", {}, aStruc)
This call does not add the table in the report. For example, this produces an error:
oTest:SetMaster (...)
Obviously arrays should not be empty. But in any case you should get a valid oTest object. The sturcture of the array data should be equal to aStruc. So an empty array is not valid.
Regards,
-
- Mensajes: 42
- Registrado: Sab Ago 10, 2013 2:39 am
AddArray
I think the object is _not_ valid. Please look at the following example:
#include "frh.ch"
PROC Main
oFr := FrReportManager():New()
oFr:Create()
f := {{"t_id", "N", 10, 0}}
a := {}
AAdd (a, {100})
AAdd (a, {200})
AAdd (a, {300})
oA1 := oFr:AddArray ("niz1", a, f)
b := {}
AAdd (b, {100}) // (*)
AAdd (b, {200}) // (*)
f := {{"t_id", "N", 10, 0}} // (**)
oA2 := oFr:AddArray ("niz2", b, f)
oA2:SetMaster (oA1, {"t_id=t_id"})
oFr:DesignReport()
oFr:End()
RETURN
This application works correctly. But, if you delete the (*) lines (table oA2 is empty), receives the error "SetMaster detail - Detail field t_id not found".
BTW, seems to AddArray has a bug. Check the value of F before and after the call AddArray:
before:
f := {{"t_id", "N", 10, 0}}
after:
f := {"t_id", "N", 10, 0}
#include "frh.ch"
PROC Main
oFr := FrReportManager():New()
oFr:Create()
f := {{"t_id", "N", 10, 0}}
a := {}
AAdd (a, {100})
AAdd (a, {200})
AAdd (a, {300})
oA1 := oFr:AddArray ("niz1", a, f)
b := {}
AAdd (b, {100}) // (*)
AAdd (b, {200}) // (*)
f := {{"t_id", "N", 10, 0}} // (**)
oA2 := oFr:AddArray ("niz2", b, f)
oA2:SetMaster (oA1, {"t_id=t_id"})
oFr:DesignReport()
oFr:End()
RETURN
This application works correctly. But, if you delete the (*) lines (table oA2 is empty), receives the error "SetMaster detail - Detail field t_id not found".
BTW, seems to AddArray has a bug. Check the value of F before and after the call AddArray:
before:
f := {{"t_id", "N", 10, 0}}
after:
f := {"t_id", "N", 10, 0}
- ignacio
- Site Admin
- Mensajes: 9257
- Registrado: Lun Abr 06, 2015 8:00 pm
- Ubicación: Madrid, Spain
- Contactar:
AddArray
Dear Sir,
Cita:This application works correctly. But, if you delete the (*) lines (table oA2 is empty), receives the error "SetMaster detail - Detail field t_id not found".
The bug arises because your array structure is not equal to your fields structure. So to say, you can not use empty arrays.
Cita:after:
f := {"t_id", "N", 10, 0}
The property admits an array of arrays or an array of string with this structure: <name>,<type>,<len>,<dec>. If you use the first method then is converted to an array of string:
f := {"t_id,N, 10, 0"}
If you do not want that to happens send a aClone( f ). BTW, it will be fixed on next release.
Regards,
Cita:This application works correctly. But, if you delete the (*) lines (table oA2 is empty), receives the error "SetMaster detail - Detail field t_id not found".
The bug arises because your array structure is not equal to your fields structure. So to say, you can not use empty arrays.
Cita:after:
f := {"t_id", "N", 10, 0}
The property admits an array of arrays or an array of string with this structure: <name>,<type>,<len>,<dec>. If you use the first method then is converted to an array of string:
f := {"t_id,N, 10, 0"}
If you do not want that to happens send a aClone( f ). BTW, it will be fixed on next release.
Regards,
-
- Mensajes: 42
- Registrado: Sab Ago 10, 2013 2:39 am
AddArray
ignacio wrote on Wed, 19 November 2014 14:30Dear Sir,
Cita:This application works correctly. But, if you delete the (*) lines (table oA2 is empty), receives the error "SetMaster detail - Detail field t_id not found".
The bug arises because your array structure is not equal to your fields structure. So to say, you can not use empty arrays.
I think it's a bit illogical, but ok. If I want to add a table via AddArray, I suppose I must add a "phantom empty record" when table is empty?
Cita:This application works correctly. But, if you delete the (*) lines (table oA2 is empty), receives the error "SetMaster detail - Detail field t_id not found".
The bug arises because your array structure is not equal to your fields structure. So to say, you can not use empty arrays.
I think it's a bit illogical, but ok. If I want to add a table via AddArray, I suppose I must add a "phantom empty record" when table is empty?