0
I am developing a report that should return a table whose data comes from a class, where this class has List type property.
The problem is that when I report it appears #Error in column data.
The object class is serialized and has an empty constructor.
Follow the class with the lists of objects and later the class where I point to the Dataset.
namespace ASoftware.Model.Entities
{
[Serializable]
public class ClientesEntities
{
public List<string> Nomes { get; private set; }
public List<string> Horarios { get; private set; }
public List<string> Telefones { get; private set; }
public List<string> ValoresTotais { get; private set; }
public List<string> Situacoes { get; private set; }
public ClientesEntities()
{
}
public ClientesEntities(List<string> nomes, List<string> horarios, List<string> telefones, List<string> valoresTotais, List<string> situacoes)
{
Nomes = nomes;
Horarios = horarios;
Telefones = telefones;
ValoresTotais = valoresTotais;
Situacoes = situacoes;
}
}
}
namespace ASoftware.View
{
[Serializable]
public partial class RelatorioView : Form
{
List<ClientesEntities> ListadeClientes;
public RelatorioView()
{
InitializeComponent();
}
public void PopulandoClientesEntities(ClientesView view) // Método para popular uma lista de strings e retorna uma lista de clientes
{
List<string> nomes = new List<string>();
List<string> horarios = new List<string>();
List<string> telefones = new List<string>();
List<string> valoresTotais = new List<string>();
List<string> situacoes = new List<string>();
for (int i = 0; i < view.Grid_Clientes.RowCount; i++)
{
nomes.Add($"{view.Grid_Clientes.Rows[i].Cells["TabNome_Cliente"].Value};");
horarios.Add($"{ view.Grid_Clientes.Rows[i].Cells["TabHorario_Cliente"].Value};");
telefones.Add($"{ view.Grid_Clientes.Rows[i].Cells["TabTelefone_Cliente"].Value };");
valoresTotais.Add($"{ view.Grid_Clientes.Rows[i].Cells["TabValordoServico_Cliente"].Value};");
situacoes.Add($"{ view.Grid_Clientes.Rows[i].Cells["TabSituacao_Cliente"].Value};");
}
ListadeClientes = new List<ClientesEntities>
{
new ClientesEntities(nomes, horarios, telefones, valoresTotais, situacoes)
};
}
private void RelatorioView_Load(object sender, EventArgs e)
{
reportViewer1.LocalReport.DataSources.Clear();
reportViewer1.LocalReport.DataSources.Add(new Microsoft.Reporting.WinForms.ReportDataSource("ClientesEntitiesDataSet", ListadeClientes));
reportViewer1.RefreshReport();
}
}
}
Remark: I did the test with static object and its certain, I believe the problem is the expression in the report.rdlc.