Página 1 de 1

SetProperty()

Publicado: Mar Mar 11, 2014 6:57 pm
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.

SetProperty()

Publicado: Mar Mar 11, 2014 7:49 pm
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,

SetProperty()

Publicado: Mar Mar 11, 2014 8:17 pm
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.

SetProperty()

Publicado: Mar Mar 11, 2014 8:46 pm
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,

SetProperty()

Publicado: Mar Mar 11, 2014 9:31 pm
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.

SetProperty()

Publicado: Mar Mar 11, 2014 10:44 pm
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,

SetProperty()

Publicado: Mié Mar 12, 2014 10:57 am
por ignacio


Attached files