Here is my solution to use fastreport with a xailer tsqlquery.
The functions SetXailerDataSet and GetSQLValue will pass a datasource to
fastreport.
I post it here, as a thank you for all the help you give me.
Ronald
//---------------------------------------------------------- --------------------
METHOD Button1Click( oSender ) CLASS TForm1
// this is an example sql query. make your own queries, as long as you give
every column an alias.
// in this example fastreport will receive a dataset with the alias:
HARDWARE and the fields: description, uren and day.
with object ::oSQLQuery1
IF :lOpen
:Close()
ENDIF
:cSelect := "SELECT billingTimeDurationEntries.durationDescription
description, " + ;
"billingTimeDurationEntries.hoursTotal uren, " + ;
"billingTimeDurationEntries.startDay day, " + ;
"FROM billingtimedurationentries WHERE etcetera etcetera ORDER
BY; "
:Open()
:GoTop()
END WITH
SetXailerDataSet( FrPrn, "HARDWARE" , ::oSQLQuery1 )
DoFrAction( "hardware.fr3" )
RETURN Nil
//---------------------------------------------------------- --------------------
function SetXailerDataSet(oFrManager, cFrAlias, oDataSet)
//---------------------------------------------------------- --------------------
local cStr:='', x, aVelden
for x := 1 to len( oDataSet:aFields)
cStr+=oDataSet:aFields[x]:cName + ";"
next
aVelden := oDataSet:aFields
oFrManager:SetUserDataSet(cFrAlias, cStr,;
{||oDataSet:GoTop}, {||oDataSet:Skip(1)}, ;
{||oDataSet:Skip(-1)}, {||oDataSet:Eof},;
{|cField| GetSQLValue( cField, oDataSet)})
Return Nil
//---------------------------------------------------------- --------------------
function GetSQLValue( cField, oDataSet)
local cRet := "", nPos, aVelden
// get the position of current fieldname in fields array
aVelden := oDataSet:aFields
nPos := ascan( aVelden,{|aVal| aVal:cName == cField})
// get the value
cRet := oDataSet:aFields[nPos]:Value
RETURN cRet
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.
fastreport tsqlquery solved
-
- Mensajes: 44
- Registrado: Dom Abr 19, 2009 10:01 am