Crystal Report issue

Posts   
 
    
mds avatar
mds
User
Posts: 33
Joined: 24-Sep-2006
# Posted on: 26-Sep-2006 19:44:26   

Hi I'm using Crystal Report (the version integrated in VS2005) to generate report for my app... I'm looking for some best practice to use it with LLBLGEN. Actually i create a typed dataset with the IDE designer and design my report. At run time i create typed dataset and fill it with entity/collection data using CreateProjection of EntityView. Since CreateProjection requires a list of all fields to bind, i've create a function that do this automatically:


Public Shared Function ProjectEntityViewOnTable(ByVal Tb As DataTable, _
                                            ByVal EntityVw As IEntityView) As Boolean
            'Project entityview on Datatable including all the fields that have the same DB name of table's columns

            If EntityVw.Count = 0 Then Return False
            Dim Entity As EntityBase = EntityVw.Item(0)

            Dim ProjProp As New Generic.List(Of IEntityPropertyProjector)

            Dim NmCmp As String
            Dim Fld As EntityField

            For i As Integer = 0 To Tb.Columns.Count - 1
                NmCmp = Tb.Columns(i).ColumnName
                Fld = LLBLGenDAL.Utility.getEntityFieldFromDbName(Entity, NmCmp)
                If Not Fld Is Nothing Then
                    If Not Fld.IsIdentity Then
                        ProjProp.Add(New EntityPropertyProjector(Fld, NmCmp))
                    End If
                End If
            Next i
            EntityVw.CreateProjection(ProjProp, Tb)

        End Function

The function getEntityFieldFromDbName returns the fields that have the same name in the DB


Public Shared Function getEntityFieldFromDbName(ByVal Entity As EntityBase, ByVal NomeCampo As String) As EntityField
            NomeCampo = NomeCampo.ToUpper
            For i As Integer = 0 To Entity.Fields.Count - 1
                If Entity.Fields(i).SourceColumnName.ToUpper = NomeCampo Then
                    Return Entity.Fields(i)
                End If
            Next
            Return Nothing
        End Function

When i have only one row to include in the report, i'd like to create an overloaded version of ProjectEntityViewOnTable that accept a Datatable and a generic Entity, but since I have to create an EntityView to project data.. i'm not able to build the collection starting from a generic Entity.(How can I do ???)

I'm new on using LLBLGen and I'm not sure this is the right direction ... I appreciate any comment. Thanks !!!

Rogelio
User
Posts: 221
Joined: 29-Mar-2005
# Posted on: 27-Sep-2006 00:43:20   

Hi,

I use TypedList as the datasource of crystal report. In the LLBLGen designer I can join all the tables (entities) from where I will need data. I develop an utility that allow me to create a xml schema from the typedlist and I use this schema to design my reports.

mds avatar
mds
User
Posts: 33
Joined: 24-Sep-2006
# Posted on: 29-Sep-2006 16:55:16   

Rogelio wrote:

Hi,

I use TypedList as the datasource of crystal report. In the LLBLGen designer I can join all the tables (entities) from where I will need data. I develop an utility that allow me to create a xml schema from the typedlist and I use this schema to design my reports.

Thanks for your replay... I'm new with LLBLGEN and i'll study TypedList... with your method i'll be able to pass an object directly to CR ?

Rogelio
User
Posts: 221
Joined: 29-Mar-2005
# Posted on: 30-Sep-2006 02:08:16   

mds wrote:

Rogelio wrote:

Hi,

I use TypedList as the datasource of crystal report. In the LLBLGen designer I can join all the tables (entities) from where I will need data. I develop an utility that allow me to create a xml schema from the typedlist and I use this schema to design my reports.

Thanks for your replay... I'm new with LLBLGEN and i'll study TypedList... with your method i'll be able to pass an object directly to CR ?

Yes, you only have to: 1. Fill the typedlist. 2. If necesary do some processing over the rows, for example to calculate some values. 3. Pass the typedlist directly to CR.

I developed an utility to create the xml schema from the DBGeneric dll that contains the typedlist, let me know if you need a copy.

mds avatar
mds
User
Posts: 33
Joined: 24-Sep-2006
# Posted on: 02-Oct-2006 23:51:12   

Rogelio wrote:

...... Yes, you only have to: 1. Fill the typedlist. 2. If necesary do some processing over the rows, for example to calculate some values. 3. Pass the typedlist directly to CR.

I developed an utility to create the xml schema from the DBGeneric dll that contains the typedlist, let me know if you need a copy.

Thanks !!! Can you send me a copy to matds AT iol.it. Bye