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.

TDBBrowse to Excel

Xailer professional forum in English
Responder
Maarten Roos
Mensajes: 126
Registrado: Lun Mar 29, 2010 10:24 am

TDBBrowse to Excel

Mensaje por Maarten Roos »

Hello.
Is it possible to export data from TDDBrowse, including the OnGetData values, to Excel?
If yes, how to do? I have no idea how to export the values from the OnGetData?
Avatar de Usuario
ignacio
Site Admin
Mensajes: 9447
Registrado: Lun Abr 06, 2015 8:00 pm
Ubicación: Madrid, Spain
Contactar:

TDBBrowse to Excel

Mensaje por ignacio »

Maarten,
Try to use the REPORT engine included with Xailer. Two tips:
1) Set the dataset with the clause REPORT oReport .... DATASET oMyDataset
2) Send the report to Excel with oReport:ToExcel( cFile )
Note: Excel should be installed on the client PC.
Regards,
Ignacio Ortiz de Zúñiga
[Equipo de Xailer / Xailer team]
http://www.xailer.com
http://www.xailer.info
http://www.xailer.com/forum
http://www.xailer.com/dokuwiki
"Maarten Roos" escribió en el mensaje de
noticias:4d244111$[email=1@svctag-j7w3v3j....]1@svctag-j7w3v3j....[/email]
Hello.
Is it possible to export data from TDDBrowse, including the
OnGetData values, to Excel?
If yes, how to do? I have no idea how to export the values
from the OnGetData?
Ignacio Ortiz de Zúñiga
[OZ Software]
https://www.ozs.es
--
[Equipo de Xailer / Xailer team]
https://www.xailer.com
Maarten Roos
Mensajes: 126
Registrado: Lun Mar 29, 2010 10:24 am

TDBBrowse to Excel

Mensaje por Maarten Roos »

I have managed to export a dataset to Excel... but how do I use values from other datasets to use full name instead of code?
The dataset has relations to other datasets, but no idea to get them when needed?

METHOD ExportToExcel() CLASS frmNotesSearch
LOCAL aHeader := {}, aField := {}, x := 1, Ohulp := ::oBrw:aCols
for x=1 to len(::oBrw:aCols)
if ::oBrw:aCols[x]:lVisible
if Upper(::oBrw:aCols[x]:oDataField:ClassName())==Upper("TDataField")
AADD(aHeader,::oBrw:aCols[x]:cHeader)
AADD(aField,::oBrw:aCols[x]:oDataField:cDbfName)
endif
endif
next
if len(aHeader)<>0
ExportToExcel(::oDbfTN, "Telephone Notes", aHeader, aField)
else
MsgInfo("Nothing to export...")
endif
RETURN NIL


Function ExportToExcel(oDataSet, cTitle, aHeader, aField)
Local oReport, x, cHeader, cField
oDataSet:Select()
REPORT oReport ;
TITLE cTitle
oReport:oDataSet = oDataSet
For x := 1 To Len(aField)
cHeader := '"' + aHeader[x] + '"'
cField := aField[x]
COLUMN OF oReport ;
Title &cHeader ;
DATA &cField
Next
oReport:cJobName := "Excel Converter"
oReport:ToExcel()
RETURN NIL

But this will use only one dataset (oDbfTN)
I like to use the same data as shown in the browser (oBrw) to be exported to Excel.
So this...

Gives me now...

Avatar de Usuario
ignacio
Site Admin
Mensajes: 9447
Registrado: Lun Abr 06, 2015 8:00 pm
Ubicación: Madrid, Spain
Contactar:

TDBBrowse to Excel

Mensaje por ignacio »

Maarten,
COLUMN ... OF oReport ;
TITLE ... ;
DATA MyRelation( oDatasetMain, oDataSetRel )
....
STATIC FUNCTION MyRelation( oMain, oRel )
oRel:Locate( <expression involving oMain > )
RETURN oRel:MyRelField
Regards,
Ignacio Ortiz de Zúñiga
[Equipo de Xailer / Xailer team]
http://www.xailer.com
http://www.xailer.info
http://www.xailer.com/forum
http://www.xailer.com/dokuwiki
"Maarten Roos" escribió en el mensaje de
noticias:4d2454c7$[email=1@svctag-j7w3v3j....]1@svctag-j7w3v3j....[/email]
I have managed to export a dataset to Excel... but how do I
use values from other datasets to explain full name instead
of code?
The dataset has relations to other datasets, but no idea to
get them when needed?
METHOD ExportToExcel() CLASS frmNotesSearch
LOCAL aHeader := {}, aField := {}, x := 1, Ohulp :=
::oBrw:aCols
for x=1 to len(::oBrw:aCols)
if ::oBrw:aCols[x]:lVisible
if
Upper(::oBrw:aCols[x]:oDataField:ClassName())==Upper("TDataField ")
AADD(aHeader,::oBrw:aCols[x]:cHeader)
AADD(aField,::oBrw:aCols[x]:oDataField:cDbfName)
endif
endif
next
if len(aHeader)<>0
ExportToExcel(::oDbfTN, "Telephone Notes", aHeader,
aField)
else
MsgInfo("Nothing to export...")
endif
RETURN NIL
Function ExportToExcel(oDataSet, cTitle, aHeader, aField)
Local oReport, x, cHeader, cField
oDataSet:Select()
REPORT oReport ;
TITLE cTitle
oReport:oDataSet = oDataSet
For x := 1 To Len(aField)
cHeader := '"' + aHeader[x] + '"'
cField := aField[x]
COLUMN OF oReport ;
Title &cHeader ;
DATA &cField
Next
oReport:cJobName := "Excel Converter"
oReport:ToExcel()
RETURN NIL
But this will use only one dataset (oDbfTN)
I like to use the same data as shown in the browser (oBrw)
to be exported to Excel.
So this...
Give me now...
Ignacio Ortiz de Zúñiga
[OZ Software]
https://www.ozs.es
--
[Equipo de Xailer / Xailer team]
https://www.xailer.com
Maarten Roos
Mensajes: 126
Registrado: Lun Mar 29, 2010 10:24 am

TDBBrowse to Excel

Mensaje por Maarten Roos »

Thx, but wasn't the solution I was looking for... but it gave me a brainwave to the solution.
Responder