none
RDLC #error using LookUp() and string concatenation RRS feed

  • Domanda

  • Hi all. We recently moved our App from .NET Framework 4.6.1 (on VB.Net and VS2015) to .NET Framework 4.8 with VS2019.

    Now we have a little problem with a RDLC report using LookUp function and concatenating strings. Everything works well in preview, but when we try to export the report in PDF, concatenated fields result in #Error.

    Report has a DataSet with 3 tables

    Table "SchedeTecniche" has all the data of the report. Table "Diciture" has all the labels of the report in various languages. Both tables have a field "CodLin"; this field represent the language of the report data, and is used (from a single SchedeTecniche row) to gather all the lables in the correct language from table Diciture.

     

    Field "CodLin" is declared in RDLC file as follows in both tables

            <Field Name="CodLin">
              <DataField>CodLin</DataField>
              <rd:TypeName>System.String</rd:TypeName>
            </Field>

    The report is a simple List Tablix which prints every row of the table SchedeTecniche. Problem is here with these two expressions:

    Expression A is

    =Lookup(Fields!CodLin.Value, Fields!CodLin.Value, Fields!Eti051.Value, "Diciture") & Fields!CodVar.Value

    while expression B is

    =Lookup(Fields!CodLin.Value, Fields!CodLin.Value, Fields!Eti052.Value, "Diciture") & Format(CDate(Fields!DatOraAgg.Value), "dd/MM/yy HH:mm")

    All fields involved in the expression have a value, there is no Nothing (null) or DBNull involved. Everything is a String.

    When I open the report in preview everything works:

    But if I open print layout or try to export the report in PDF, Label text 051 and 052 result in #Error

    Note that if I change expression A in

    =Lookup(Fields!CodLin.Value, Fields!CodLin.Value, Fields!Eti051.Value, "Diciture")

    removing the concatenation with Fields!CodVar.Value, everything works, even the error on expression B disappears.

    So, I can understand that there could be an error in my expression A, but why an error in expression A also involves expression B? And, there is an error in expression A? I already tried using the .ToString() in every possible manner, using CStr() function, adding a concatenation with an additional empty string and other fancy solution, but always the same result.

    What can I do? What am I doing wrong?

    Thanks in advance for every suggestion!!



    • Modificato Elvandar83 lunedì 17 febbraio 2020 14:50
    lunedì 17 febbraio 2020 14:49