Home End User
New Blog Post: Email: Multi-Service

Cannot Assign tfieldlist to tstringlist

Hi,
I am migrating application from delphi 4 to delphi 10.4.We are using report builder in our application and template of reports are stored in database. When we are tring to open report giving this error "Cannot Assign Tfieldlist to Tstringlist" .When we look into the column of template and we have found that the error coming after addition of TppDBCalc object which is in TppSummaryBand of report as shown below.

object ppSummaryBand1: TppSummaryBand
mmBottomOffset = 0
mmHeight = 36513
mmPrintPosition = 0
object ppLabel7: TppLabel
UserName = 'Label7'
Alignment = taRightJustify
Caption = 'Nombre total de rapports transcrits : '
Font.Charset = DEFAULT_CHARSET
Font.Color = clBlack
Font.Name = 'Arial'
Font.Size = 10
Font.Style = [fsBold]
Transparent = True
mmHeight = 4233
mmLeft = 794
mmTop = 11113
mmWidth = 61119
BandType = 7
end
object ppDBCalc1: TppDBCalc
UserName = 'DBCalc1'
Alignment = taRightJustify
DataField = 'COUNT(RT.NO_REQUETE)'
DataPipeline = plListeDemandeeMemoire
Font.Charset = DEFAULT_CHARSET
Font.Color = clBlack
Font.Name = 'Arial'
Font.Size = 10
Font.Style = [fsBold]
Transparent = True
mmHeight = 4233
mmLeft = 61913
mmTop = 11113
mmWidth = 18256
BandType = 7
end
end

Comments

  • Hi Rajeev,

    If you trace into the RB source, where is the error occurring? If you save this template to file and try to load it manually, do you get the same issue? If so, please put together a simple application that demonstrates this problem (perhaps with some sample data) and send it to us in .zip format so we can research what is happening.

    It sounds like your templates could be well over 20 years old and while we do our best to keep ReportBuilder backward compatible, this is quite a jump. Some of your templates may require a manual update or recreation.

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited July 2022
    Hi,
    We have looked into this further and found that after addition of these two properties i.e, Datafield and DBCalcType (as marked in Bold) causing the issue. If we remove these two properties from report, our report is able to open and it showing blank.

    object ppDBCalc1: TppDBCalc
    UserName = 'DBCalc1'
    Alignment = taRightJustify
    DataField = 'COUNT(RT.NO_REQUETE)'
    DBCalcType = dcCount

    DataPipeline = plListeDemandeeMemoire
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clBlack
    Font.Name = 'Arial'
    Font.Size = 10
    Font.Style = [fsBold]
    Transparent = True
    mmHeight = 4233
    mmLeft = 61913
    mmTop = 11113
    mmWidth = 18256
    BandType = 7
    end


  • Hi Rajeev,

    As a test I created a calculated field Count(CustNo) using our built-in demo data. I then placed a DBCalc on a report and set its field to the calculated field. This of course was the field alias that is automatically created for each calculated field (Count_CustNo).

    I then saved the template as text and manually altered the DataField property of the DBCalc to 'Count(CustNo'. I then loaded the template successfully without any errors.

    1. Are you certain there is a calculated field in your dataset named COUNT(RT.NO_REQUETE)?

    2. It seems redundant to perform a count on a COUNT calculated field. Have you tried setting the datafield to the original field? DataField = 'RT.NO_REQUETE'.

    3. Unfortunately this may have been a bug in the earlier version that was fixed. The DataField property should either have a calculated field alias as its value or simply the DB field name.


    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited July 2022
    Hi Nico,
    Here is the code for field:

    object TppField
    FieldAlias = 'COUNT(RT.NO_REQUETE)'
    FieldName = 'COUNT(RT.NO_REQUETE)'
    FieldLength = 0
    DataType = dtDouble
    DisplayWidth = 10
    Position = 2
    end

    And below is the field code which getting after tdasql:
    object TdaSQL
    DatabaseName = 'DBname'
    DatabaseType = dtOracle
    DataPipelineName = 'plListeDemandee'
    Description = 'ListeDemandee'
    EditSQLAsText = True
    SQLText.Strings = (

    ' SELECT E.Nom_prenom "Secr'#233'taire" ,X."Sum(RT.Lettre)",X."COUNT(RT.No_REQUETE)",' +
    ' e.poincon_license '
    ' ) X)

    SQLType = sqSQL1


    object TdaField
    Alias = 'COUNT(RT.No_REQUETE)'
    DataType = dtDouble
    FieldAlias = 'COUNT(RT.No_REQUETE)'
    FieldName = 'COUNT(RT.No_REQUETE)'
    SQLFieldName = 'COUNT(RT.No_REQUETE)'
    end
  • Hi Rajeev,

    Please try manually altering the DBCalc DataField property inside the template to the DB field rather than a calculated field and see if that solves the issue.

    object ppDBCalc1: TppDBCalc
    UserName = 'DBCalc1'
    Alignment = taRightJustify
    DataField = 'RT.NO_REQUETE'
    ...

    As I mentioned before, it is redundant to perform a count calculation on a COUNT calculated field. Another option would be to use a DBText assigned to the COUNT field.


    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
Sign In or Register to comment.