MySQL recordset data not displating in Fast Reports for Harbour Master Databand
Publicado: Sab Mar 11, 2017 6:21 am
I am using Sergey Spirin Fastreport for my Harbour applications so far, but now a days Harbour new version not supporting Sergey Spirin Fastreport. So I am planing to change reports into xailer fastreport. For that, I downloaded the demo version for testing. In my case, I am using a MySQL Database ADO record set and SetUserDataset function for reports in Sergey Spirin Fastreport and same code used in xailer fastreport. In xailer fastreport design, data window shows data sets with all fields / columns. Drag the fields /columns from Data Tree into a master data band and run preview it not showing data. But in this case, ADO Table data set and drag the fields / columns into the master data band from Data Tree, then it shows the value while previewing. Following code used for reporting.
Please help me to solve this issue, then only I can think about the purchase of Fastreport
Código: Seleccionar todo
cSQL :="Select * from Branches"
oRs := FW_OpenRecordSet(oConnection, cSQL)
oFrPrn := frReportManager():new()
With Object oFrPrn
:SetUserDataset("Branch",MySqlFields(oRs),;
{|| If(!oRs:BOF() .OR. !oRs:EOF() ,oRs:MoveFirst() ,)} ,;
{|| oRs:MoveNext()} ,;
{|| oRs:MovePrev()} ,;
{|| oRs:EOF() },;
{ | aField | oRs:Fields(afield):Value })
:LoadFromFile("Branch.fr3")
:DesignReport()
:DestroyFr()
End With
*---------------------------------------------------------------------------------------------*
Function MySqlFields( oRs ) /* Generating Fast Reports Data fileds from Recordset*/
*---------------------------------------------------------------------------------------------*
Local cField := ""
Local I
Local nLen
nLen := oRs:Fields:Count()-1
For i := 0 To nLen
cField := cField + iif(oRs:Fields(i):Name='Photo',oRs:Fields(i):Name+'^b',oRs:Fields(i):Name)+ iif( i < nLen ,";","" )
Next
Return cField