llblgen and Crystal Reports

Posts   
 
    
gez
User
Posts: 5
Joined: 02-Oct-2003
# Posted on: 17-Nov-2003 22:50:22   

Can anyone recommend an approach to take with respect to developing Crystal Reports considering that we should be conscious of supporting more than one database in our applications?

In my past experience, the preferred method was to develop Crystal Reports using ODBC. Is this still the case? Does llblgen introduce an alternative to ODBC?

Thanks

Gez

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39613
Joined: 17-Aug-2003
# Posted on: 19-Nov-2003 12:03:52   

I have used crystal reports in VB5/6 and it was a disaster, I used it once in .NET for testing some things out, and it was still not that useable wink , but it's a powerful tool. What I learned was that it can only work with a typed dataset as a designer source. You can however then bind whatever you like to the report to fill data into the controls. (I haven't tested this in practise, but it should work).

So to test this: create a typed dataset which holds the entity values. Design the report. To fill the report, bind an entity collection to it at runtime.

Frans Bouma | Lead developer LLBLGen Pro
mafti
User
Posts: 38
Joined: 27-Oct-2004
# Posted on: 13-Jan-2005 17:07:00   

hi, i have a problem with crystal reports rage


        Try
            Dim rptDoc As New ReportDocument
            'Dim fileName As String = Server.MapPath(SPBSConstants.URL_RAPPORTEN & "RapportBegrotingActiviteiten.rpt")
            Dim fileName As String = Server.MapPath(SPBSConstants.URL_RAPPORTEN & "CrystalReport1.rpt")
            rptDoc.Load(fileName)

            Dim col As New ActiviteitCollection      'BegrotingAanvraagActiviteitenRptTypedView
            Dim sorter As ISortExpression
            Dim filter As IPredicateExpression

            sorter = Nothing
            filter = Nothing

            'col.Fill(0, sorter, False, filter)
            Dim dt As DataTable = col.GetMultiAsDataTable(Nothing, 0, Nothing)
            rptDoc.SetDataSource(dt)
            CRViewer.ReportSource = rptDoc
        Catch ex As Exception
            ErrorMessage.Text = ex.Message & "<hr>" & ex.StackTrace
        End Try

works, but when i use a typedview. de result is always empty. although the count is > 0 .

i find it strange when i do col.Dataset it gives nothing.

thus



dim tv as new fooTypedView
tv.fill(...)
if (tv.DataSet is nothing)
 'this is true
end if

is this a bug, or do i something wrong??

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39613
Joined: 17-Aug-2003
# Posted on: 13-Jan-2005 20:31:28   

Every control bound to a datatable derived class will bind to a dataview, so I find it really strange this happens. If you cast the typed view to a DataTable, does it work then?

Frans Bouma | Lead developer LLBLGen Pro
mafti
User
Posts: 38
Joined: 27-Oct-2004
# Posted on: 17-Jan-2005 08:37:00   

Otis wrote:

Every control bound to a datatable derived class will bind to a dataview, so I find it really strange this happens. If you cast the typed view to a DataTable, does it work then?

nope, at least how i think u mean it.

getting more confused at the moment, because:

            Dim col As New ActiviteitLstTypedView
            col.Fill(0, Nothing, False, Nothing)
            'good for us, there ARE rows
            log.Logger(log.LVL_DEBUG, "aantal rijencol: " & col.Rows.Count)
            If (col.DataSet Is Nothing) Then
                'woops, this shouldn't happen but it does
                log.Logger(log.LVL_DEBUG, "ColDataset empty")
            Else
                log.Logger(log.LVL_DEBUG, "ColDataset NOT empty")
            End If

            'lets clone the baby
            Dim dt As DataTable = col

                         'same as above
            log.Logger(log.LVL_DEBUG, "aantal rijen: " & dt.Rows.Count)
            If (dt.DataSet Is Nothing) Then
                log.Logger(log.LVL_DEBUG, "Dataset empty")
            Else
                log.Logger(log.LVL_DEBUG, "Dataset NOT empty")
            End If
            rptDoc.SetDataSource(dt)

so that doesn't help me.

however i did notice that when i do:

Dim dt as DataTable = col.Clone()

that doesn't work at all. this gives me now rows in the Datatable.

mafti
User
Posts: 38
Joined: 27-Oct-2004
# Posted on: 18-Jan-2005 13:02:05   

not really want to bump this.

but anybody has got similar problems with typed views and crystal reports (addon in .net 2K3) and hopefully fixed it??

at the moment as a workaround we're using stored-procedures who call the views. really not what we want.

Skeeterbug
User
Posts: 165
Joined: 21-May-2004
# Posted on: 20-Jan-2005 14:01:14   

The typed dataset you used to design the report has to match what you pass in EXACTLY. Otherwise the report won't show any data. I used a type dataset to create mine, then passed in a typed view (it matched the typed dataset exactly). Good luck with it (its a pain).

mafti
User
Posts: 38
Joined: 27-Oct-2004
# Posted on: 25-Jan-2005 12:36:21   

hmmm, not sure what u mean,

i drop the view into a xml-sheet. this i use in Crystal Reports.

then in my code i fetch the TypedView and attach it as a datasource.

can't i use aliassen in the view?

hmmm,

what i simply don't understand is:

-create the view

create fooview as select * from foo

-i create the crystal report based on the view i created.

-at runtime i attached the typedview to report --> no go.

i create a simple storedprocedure which basically does:

select * from fooview

-at runtime i attache the storedprocedure to the view. -> it works.

M.

sorry to get repetitive cry