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.

SetProperty()

FastReport for Xailer & [x]Harbour (English/Spanish)
Responder
a.ilic
Mensajes: 37
Registrado: Vie Sep 27, 2013 1:13 am

SetProperty()

Mensaje por a.ilic »

Can anyone explain where is the mistake:
oFr:SetProperty("REPORT", "ReportOptions.cAuthor", "Peter")
The error: Could not convert variant of type (Null) into type (Integer). I'm also not able to set any EngineOptions property using this method.
In help file, this is also mentioned as an option:
Note that you can use complex expression like 'REPORT.ReportOptions.cAuthor = 'Peter''.
Tried, also without success.
Thanks.
Aleksandar Ili?
Software developer
Wings Software
http://www.wings.rs
Avatar de Usuario
ignacio
Site Admin
Mensajes: 9246
Registrado: Lun Abr 06, 2015 8:00 pm
Ubicación: Madrid, Spain
Contactar:

SetProperty()

Mensaje por ignacio »

a.ilic escribió el mar, 11 marzo 2014 18:57Can anyone explain where is the mistake:
oFr:SetProperty("REPORT", "ReportOptions.cAuthor", "Peter")
The error: Could not convert variant of type (Null) into type (Integer). I'm also not able to set any EngineOptions property using this method.
In help file, this is also mentioned as an option:
Note that you can use complex expression like 'REPORT.ReportOptions.cAuthor = 'Peter''.
Tried, also without success.
Thanks.
oReport:oReportOptions:cAuthor := "Peter"
Regards,
Ignacio Ortiz de Zúñiga
[Equipo de Xailer / Xailer team]
https://www.xailer.com
a.ilic
Mensajes: 37
Registrado: Vie Sep 27, 2013 1:13 am

SetProperty()

Mensaje por a.ilic »

ignacio wrote on Tue, 11 March 2014 19:49oReport:oReportOptions:cAuthor := "Peter"
That's the first thing I've tried. If I do that, before Create() method is invoked, I got an error:
Error BASE/1005 No exported variable: CAUTHOR
In documentation it is written: All the TFrEngine??? classes indeed they inherit from a base class with the name TFrOptions, but is not documented since none of its members can be used directly.
Aleksandar Ili?
Software developer
Wings Software
http://www.wings.rs
Avatar de Usuario
ignacio
Site Admin
Mensajes: 9246
Registrado: Lun Abr 06, 2015 8:00 pm
Ubicación: Madrid, Spain
Contactar:

SetProperty()

Mensaje por ignacio »

a.ilic escribió el mar, 11 marzo 2014 20:17ignacio wrote on Tue, 11 March 2014 19:49oReport:oReportOptions:cAuthor := "Peter"
That's the first thing I've tried. If I do that, before Create() method is invoked, I got an error:
Error BASE/1005 No exported variable: CAUTHOR
In documentation it is written: All the TFrEngine??? classes indeed they inherit from a base class with the name TFrOptions, but is not documented since none of its members can be used directly.
In order to change the DLL path the DLL is not loaded until the Create() method is called. BTW, the returning error has been fixed to return a better comment on what is happening. Keep in mind that until Create() has not been called the object can not be used.
>>In documentation it is written: All the TFrEngine??? classes
>>indeed they inherit from a base class with the name TFrOptions,
>>but is not documented since none of its members can be used
>>directly.
That's correct. You can only use the members created of the last class in the inherit tree. Ancestors members are protected and are not accessible.
Regards,
Ignacio Ortiz de Zúñiga
[Equipo de Xailer / Xailer team]
https://www.xailer.com
a.ilic
Mensajes: 37
Registrado: Vie Sep 27, 2013 1:13 am

SetProperty()

Mensaje por a.ilic »

ignacio wrote on Tue, 11 March 2014 20:46In order to change the DLL path the DLL is not loaded until the Create() method is called. BTW, the returning error has been fixed to return a better comment on what is happening. Keep in mind that until Create() has not been called the object can not be used.
Thanks, I got the point, but it's still not functioning. I made a small program with just a few lines of code:
FUNCTION Main()
LOCAL oFr
oFr := TFastReport():New()
oFr:cDllPath := "dll"
oFr:Create()
oFr:oReportOptions:cAuthor := "Peter"
oFr:LoadFromFile("report.fr3");
oFr:DesignReport()
oFr:End()
RETURN
Execute this and check for Author's value. It's empty.
Aleksandar Ili?
Software developer
Wings Software
http://www.wings.rs
a.ilic
Mensajes: 37
Registrado: Vie Sep 27, 2013 1:13 am

SetProperty()

Mensaje por a.ilic »

a.ilic wrote on Tue, 11 March 2014 21:31
Thanks, I got the point, but it's still not functioning.
Mystery resolved. Ignacio's answer + it has to be called after the report is loaded (after LoadFromFile() method invocation), in order to overwrite the values. Somehow, I overlooked that.
For the others, you have two ways to set the property value, so you can choose the one you prefer more:
// 1st
oFr:SetProperty("REPORT", "ReportOptions.Author", "Peter")
// 2nd
oFr:oReportOptions:cAuthor := "Peter"
Notice that in first option the property name is Author, and in the second one cAuthor.
Regards,
Aleksandar Ili?
Software developer
Wings Software
http://www.wings.rs
Avatar de Usuario
ignacio
Site Admin
Mensajes: 9246
Registrado: Lun Abr 06, 2015 8:00 pm
Ubicación: Madrid, Spain
Contactar:

SetProperty()

Mensaje por ignacio »



Attached files
Ignacio Ortiz de Zúñiga
[Equipo de Xailer / Xailer team]
https://www.xailer.com
Responder