I looks like I can't get FastReport Varibale value.
I set variable, and display it in report, but I am unable to get it'value from PRG.
I need access to Variables from bOnBtnSendMail to perform my own Mail send to using HB sending engine which supports GMail.
Please find attached ultra-simple example. It should print "NEW VALUE", but it doesn't do that.
Attached files e2.fr3 (1.5 KB)Â e2.prg (522 B)Â
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.
Variables from report
- ignacio
- Site Admin
- Mensajes: 9252
- Registrado: Lun Abr 06, 2015 8:00 pm
- Ubicación: Madrid, Spain
- Contactar:
Variables from report
Hello,
The variable is inaccessible due two reasons:
1) Is not intialized when you first retrieve its value. The variable does not get any value until is started (printed).
I believe FR designer does not let you change any variable value. So you should set its value at least once by code.
BTW, that is what we do with Xailer:
::DeleteCategory('Xailer')
::AddCategory('Xailer')
::AddVariable('Application:cCompany', Application:cCompany )
::AddVariable('Application:cCopyright', Application:cCopyright )
::AddVariable('Application:cDescription', Application:cDescription )
::AddVariable('Application:cDirectory', Application:cDirectory )
::AddVariable('Application:cFilename', Application:cFilename )
::AddVariable('Application:cTitle', Application:cTitle )
::AddVariable('Application:cVersion', Application:cVersion )
Maybe you can do something similar to that.
2) FR uses the underscore to distinguish between categories and variables. So, do not put them.
This code worked on my side:
oRep:OnBtnGenPdf := {|o| MsgInfo(:GetVariable( "Test" )), .t. }
Regards,
The variable is inaccessible due two reasons:
1) Is not intialized when you first retrieve its value. The variable does not get any value until is started (printed).
I believe FR designer does not let you change any variable value. So you should set its value at least once by code.
BTW, that is what we do with Xailer:
::DeleteCategory('Xailer')
::AddCategory('Xailer')
::AddVariable('Application:cCompany', Application:cCompany )
::AddVariable('Application:cCopyright', Application:cCopyright )
::AddVariable('Application:cDescription', Application:cDescription )
::AddVariable('Application:cDirectory', Application:cDirectory )
::AddVariable('Application:cFilename', Application:cFilename )
::AddVariable('Application:cTitle', Application:cTitle )
::AddVariable('Application:cVersion', Application:cVersion )
Maybe you can do something similar to that.
2) FR uses the underscore to distinguish between categories and variables. So, do not put them.
This code worked on my side:
oRep:OnBtnGenPdf := {|o| MsgInfo(:GetVariable( "Test" )), .t. }
Regards,
Variables from report
Quote:I believe FR designer does not let you change any variable value
You can create and set variables via designer (click on Report->Variables...), or via script using Set() and Get() functions.
If you look at the bottom of the image, you can see what I am trying to do: Create Dialog, and return variable M.OK='TRUE' to harbour program.
Quote:oRep:OnBtnGenPdf := {|o| MsgInfo(:GetVariable( "Test" )), .t. }
I cant retreive value set in report dialog. I always get value set in prg.
Attached files
You can create and set variables via designer (click on Report->Variables...), or via script using Set() and Get() functions.
If you look at the bottom of the image, you can see what I am trying to do: Create Dialog, and return variable M.OK='TRUE' to harbour program.
Quote:oRep:OnBtnGenPdf := {|o| MsgInfo(:GetVariable( "Test" )), .t. }
I cant retreive value set in report dialog. I always get value set in prg.
Attached files
- ignacio
- Site Admin
- Mensajes: 9252
- Registrado: Lun Abr 06, 2015 8:00 pm
- Ubicación: Madrid, Spain
- Contactar:
Variables from report
Cita:You can create and set variables via designer
SET via designer????? I could not find how, Please explain. BTW your _TEST variable was not initialized.
Cita:or via script using Set() and Get() functions.
The variable DOES NOT RECEIVE A VALUE UNTIL THE REPORT IS STARTED. WHEN YOU RETRIEVE THE VAR VALUE YOUR SCRIPT IS NOT RUNNED YET. It worked for me because I retrieve the var value on the OnBtnPdf event.
Cita:I cant retreive value set in report dialog. I always get value set in prg.
You do not need to create, nor to set its value, if already exists on your fr3 file.
Regards,
SET via designer????? I could not find how, Please explain. BTW your _TEST variable was not initialized.
Cita:or via script using Set() and Get() functions.
The variable DOES NOT RECEIVE A VALUE UNTIL THE REPORT IS STARTED. WHEN YOU RETRIEVE THE VAR VALUE YOUR SCRIPT IS NOT RUNNED YET. It worked for me because I retrieve the var value on the OnBtnPdf event.
Cita:I cant retreive value set in report dialog. I always get value set in prg.
You do not need to create, nor to set its value, if already exists on your fr3 file.
Regards,
Variables from report
Quote:The variable DOES NOT RECEIVE A VALUE UNTIL THE REPORT IS STARTED.
No need to yell.
I initialize variable TEST in report designer.
Then on report create I change value (in PascalScript) to "NEW VALUE". That "NEW VALUE" is displayed on the report preview.
I would like to retrieve that "NEW VALUE" to Harbour app.
To do that I set block on bOnSendMail which uses GetVariable(), and simple print to screen.
I have a preview and "NEW VALUE" on screen.
Then I clik on Export->Email...
Retrieved value is not "NEW VALUE", but old value set in designer.
Attached is, perhaps a bit better, example without underscore on TEST, which demonstrates what I wrote.
Quote:SET via designer????? I could not find how, Please explain.
Here is the official manual. Creating and initializatiing of variables via designer:
http://www.fast-report.com/documentatio ... index.html? calling_the_variables_from_the_reports_variables_list.htm
Here is the official manual. Creating and initializatiing of variables via designer:
http://www.fast-report.com/documentatio ... index.html? calling_the_variables_from_the_reports_variables_list.htm
Attached files e2.fr3 (1.7 KB)Â e2.prg (565 B)Â
No need to yell.
I initialize variable TEST in report designer.
Then on report create I change value (in PascalScript) to "NEW VALUE". That "NEW VALUE" is displayed on the report preview.
I would like to retrieve that "NEW VALUE" to Harbour app.
To do that I set block on bOnSendMail which uses GetVariable(), and simple print to screen.
I have a preview and "NEW VALUE" on screen.
Then I clik on Export->Email...
Retrieved value is not "NEW VALUE", but old value set in designer.
Attached is, perhaps a bit better, example without underscore on TEST, which demonstrates what I wrote.
Quote:SET via designer????? I could not find how, Please explain.
Here is the official manual. Creating and initializatiing of variables via designer:
http://www.fast-report.com/documentatio ... index.html? calling_the_variables_from_the_reports_variables_list.htm
Here is the official manual. Creating and initializatiing of variables via designer:
http://www.fast-report.com/documentatio ... index.html? calling_the_variables_from_the_reports_variables_list.htm
Attached files e2.fr3 (1.7 KB)Â e2.prg (565 B)Â
Variables from report
This issue remains in new FRX version.
Just for reminder, when example above is compiled and started:
* Report is shown with "NEW VALUE" displayed on report preview
* Click on Export->Email...
* This should print on terminal "NEW VALUE", but it doesn't (instead prints old value)
It looks like report values are not retreived from FR Report object, but from some kind of
internal FRX cache which is not updated after creation.
Just for reminder, when example above is compiled and started:
* Report is shown with "NEW VALUE" displayed on report preview
* Click on Export->Email...
* This should print on terminal "NEW VALUE", but it doesn't (instead prints old value)
It looks like report values are not retreived from FR Report object, but from some kind of
internal FRX cache which is not updated after creation.
- ignacio
- Site Admin
- Mensajes: 9252
- Registrado: Lun Abr 06, 2015 8:00 pm
- Ubicación: Madrid, Spain
- Contactar:
Variables from report
dmajkic escribió el vie, 28 noviembre 2014 11:26This issue remains in new FRX version.
Just for reminder, when example above is compiled and started:
* Report is shown with "NEW VALUE" displayed on report preview
* Click on Export->Email...
* This should print on terminal "NEW VALUE", but it doesn't (instead prints old value)
It looks like report values are not retreived from FR Report object, but from some kind of
internal FRX cache which is not updated after creation.
This code is working fine here:
WITH OBJECT TFastReport():New()
:Create()
:cFilename := ".Reportse2.fr3"
MsgInfo(:GetVariable( "Test" ))
:OnBtnGenPdf := {|o| MsgInfo(:GetVariable( "Test" )), .t. }
:DesignReport()
:End()
END WITH
Regards,
Just for reminder, when example above is compiled and started:
* Report is shown with "NEW VALUE" displayed on report preview
* Click on Export->Email...
* This should print on terminal "NEW VALUE", but it doesn't (instead prints old value)
It looks like report values are not retreived from FR Report object, but from some kind of
internal FRX cache which is not updated after creation.
This code is working fine here:
WITH OBJECT TFastReport():New()
:Create()
:cFilename := ".Reportse2.fr3"
MsgInfo(:GetVariable( "Test" ))
:OnBtnGenPdf := {|o| MsgInfo(:GetVariable( "Test" )), .t. }
:DesignReport()
:End()
END WITH
Regards,