Skip to Content
avatar image
Former Member

Using .Net Objects to bind a collection with a property of type List to a Crystal Report

Hi.

I'm trying bind my c# object collection to a Crystal Report for 2 weeks with no success.

The layout I need is like this:

I have a relashionship of 2 classes as follows:

public class CRListaCompromissosTarefasProcessos
{
    public int Id { get; set; }


    [LefDisplay(ProcessosResources._PASTA)]
    public string Pasta { get; set; }


    [LefDisplay(ProcessosResources._TITULO)]
    public string Titulo { get; set; }


    [LefDisplay(ProcessosResources._NUMERO)]
    public string Numero { get; set; }


    [LefDisplay(ProcessosResources._INSTANCIA)]
    public string Instancia { get; set; }


    [LefDisplay(ProcessosResources._TRIBUNAL)]
    public string Tribunal { get; set; }


    [LefDisplay(ProcessosResources._ACAO_RECURSO)]
    public string AcaoGL { get; set; }


    [LefDisplay(ProcessosResources._JURISDICAO)]
    public string Jurisdicao { get; set; }


    [LefDisplay(ProcessosResources._RESPONSAVEL)]
    public string Responsavel { get; set; }


    [LefDisplay(ProcessosResources._CLIENTE)]
    public string ClienteText { get; set; }


    [LefDisplay(SharedResources._CONTRARIO)]
    public string ContrarioText { get; set; }


    [LefDisplay(ProcessosResources._OBSERVACAO)]
    public string Observacao { get; set; }


    public List<ReportCompromissoTarefaProcessosModelSectionCompromissosTarefas> Compromissos { get; set; }
}


public class ReportCompromissoTarefaProcessosModelSectionCompromissosTarefas
{
    public int IdProcesso { get; set; }
        
    [LefDisplay(AgendaResources._COMPROMISSOS_TAREFAS_DOIS_PONTOS)]
    public string CompromissosTarefasLabel { get; set; }


    [LefDisplay(AgendaResources._TIPO)]
    public string CompromissoOuTarefaText { get; set; }


    [LefDisplay(AgendaResources._DATA_INICIO)]
    public string DtInicio { get; set; }


    [LefDisplay(AgendaResources._HORA_INICIO)]
    public string HoraInicioText { get; set; }


    [LefDisplay(AgendaResources._DATA_TERMINO_CONCLUSAO)]
    public string DtTerminoConclusao { get; set; }


    [LefDisplay(AgendaResources._HORA_TERMINO)]
    public string HoraTerminoText { get; set; }


    [LefDisplay(AgendaResources._DATA_PUBLICACAO_DISPONIBILIZACAO)]
    public string DtPublicacaoDisponibilizacao { get; set; }


    [LefDisplay(AgendaResources._TIPO_SUBTIPO)]
    public string TipoText { get; set; }


    [LefDisplay(AgendaResources._DESCRICAO)]
    public string Descricao { get; set; }


    [LefDisplay(AgendaResources._STATUS)]
    public string StatusText { get; set; }


    [LefDisplay(AgendaResources._LOCAL)]
    public string Local { get; set; }
}

As you can see, I need a loop for the "Compromissos" property of CRListaCompromissosTarefasProcessos class.

In my researches I found someones saying I should use a subreport, but I have not found any example of implementation.

P.S.: The main class is a collection too. I'm passing a list of CRListaCompromissosTarefasProcessos, and for each item of this type I have a collection in the "Compromissos" property.

I really want to use CR because it is very simple and I'd used it in the past, but never had to do it with a structure like this .

Any help will be apreciatted.

Thanks a lot.

cr.png (67.2 kB)
cr.png (67.2 kB)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    Nov 30, 2016 at 09:47 PM

    Added Crystal Reports Tag, someone in the Report Designer should be able to help

    Add comment
    10|10000 characters needed characters exceeded