Error in custom code fields when exporting Reportviewer (RDLC) report to PDF

Asked

Viewed 32 times

0

I have a custom code in a Reportviewer (RDLC) report that basically checks whether a specific date is within a date range contained in a set of ranges coming from a database and returns a value.

The custom code of the report, to better understand the logic, this:

Public Function VerificarAusências(ByVal dia As Integer, ByVal competencia As DateTime, ByVal prefixo As String, ByVal ids As Object(), ByVal inicios As Object(), ByVal terminos As Object()) As String
    Dim hoje As DateTime = competencia.AddDays(dia)

    For i As Integer = 0 To inicios.Length - 1
        Dim lInicio As DateTime = CType(inicios(i), DateTime)
        Dim lTermino As DateTime = CType(terminos(i), DateTime)

        If lInicio <= hoje AndAlso hoje <= lTermino Then
            Return prefixo & ids(i).ToString()
        End If
    Next

    Return Nothing
End Function

In some fields of the report I put the following expression that passes some arrays to the above code:

=Code.VerificarAusências(0, Parameters!Competência.Value, "L", LookupSet(Fields!IdFuncionário.Value, Fields!IdFuncionário.Value, Fields!IdLicença.Value, "vi_licencas_resumo"), LookupSet(Fields!IdFuncionário.Value, Fields!IdFuncionário.Value, Fields!Início.Value, "vi_licencas_resumo"), LookupSet(Fields!IdFuncionário.Value, Fields!IdFuncionário.Value, Fields!Término.Value, "vi_licencas_resumo"))

The most interesting thing is that everything works well when the report is rendered and printed, but when I go to export to PDF or even Word, the fields containing the above expression appear as having error: #Erro

Could someone help me?

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.