RE: Getting code control of the DisplayString formatting formula

      Hi everybody,

      in particular Don Williams (ref. thread [“Display string” formatting formula|“Display string” formatting formula] from the Legacy Application Development SDKs forum).

      I want to get control of the DisplayString formatting formula from code. I use Crystal Reports XI R2 and Visual Studio 2005. According to Don Williams in the referenced thread:


      I had a look in our new report engine included with CR XI R2 (11.5) SP 2 RAS and it appears this feature is available.

      Public Const crObjectFormatConditionFormulaTypeDisplayString As CrystalDecisions.ReportAppServer.ReportDefModel.CrObjectFormatConditionFormulaTypeEnum = 9

      Member of: CrystalDecisions.ReportAppServer.ReportDefModel.CrObjectFormatConditionFormulaTypeEnum


      From this, I assume that the mentioned functionality should be available in my programming environment.

      In Crystal Reports XI Designer, I can set a formula for the Display String. This works fine.

      For various other issues (ToolTip, HyperLink, FontColor..) I can get to the correponding ConditionFormula from code, via the ReportClientDocument object model. However, the DisplayString condition formula returns nothing in code even if I inserted a formula there in the designer.

      Where does the Designer store the display string formatting formula?

      I would expect the following to work, but my lstr always returns nothing even if I inserted a formula in the designer. Also, it doesn’t work to insert a DisplayString formula like I do below – it won’t take effect.

      1. Private Sub SetContentFormula(ByVal pstrFieldName As String, ByVal pstrFormula As String)
      2. ' crRepDef is type CrystalDecisions.ReportAppServer.ReportDefModel.ISCRReportDefinition
      3. Dim col As ISCRFieldObject = CType(crRepDef.FindObjectByName(pstrFieldName), ISCRFieldObject)
      4. Dim lstr As String = col.Format.ConditionFormulas.Formula(CrObjectFormatConditionFormulaTypeEnum.crObjectFormatConditionFormulaTypeDisplayString).Text
      5. If lstr Is Nothing Then
      6. 'Create a new formula for this object (i.e. this column in the report)
      7. Dim cf As ISCRConditionFormula = New ConditionFormula
      8. Dim colTemp As ISCRFieldObject = col
      9. cf.Text = pstrFormula
      10. cf.CopyTo(colTemp.Format.ConditionFormulas.Formula(CrObjectFormatConditionFormulaTypeEnum.crObjectFormatConditionFormulaTypeDisplayString))
      11. rptDoc.ReportClientDocument.ReportDefController.ReportObjectController.Modify(col, colTemp)
      12. Else
      13. col.Format.ConditionFormulas.Formula(CrObjectFormatConditionFormulaTypeEnum.crObjectFormatConditionFormulaTypeDisplayString).Text = pstrFormula
      14. End If
      15. End Sub

      I donu2019t see how I can solve this with formula fields because of my overall design. I have only one .rpt file working as a template. In it I have heading fields, column fields etc. and I run a lot of reports against it. Each report is defined 100% in an .xml file, which contains formatting formulas and other things. These formulas apply to different report columns (i.e. field objects) for different reports. My software takes the .xml file as input, fetch the report data (as specified in the xml file), applies formatting formulas etc. to the various fields and everything works fine. Except the DisplayString formula.

      If this is a bug in Crystal Reports XI R2, how can I find out if it is fixed and if so get a fixed software?

      Thank you for help

      Kjell Arne

      Hello, Kjell;   What updates do you have on your Crystal Reports XI R2?   If you go to C:\Windows\Assembly\CrystalDecisions.CrystalReports.Engine.dll, right click and go to Properties|Version tab, what is the full version of the file? 11.5.97xx.xxx   Elaine

      User Rating: Be the first one !
      Add Comment
      1 Answers

        Hello, Kjell;

         

        What updates do you have on your Crystal Reports XI R2?

         

        If you go to C:\Windows\Assembly\CrystalDecisions.CrystalReports.Engine.dll, right click and go to Properties|Version tab, what is the full version of the file? 11.5.97xx.xxx

         

        Elaine

        Add Comment

        Your Answer

        By posting your answer, you agree to the privacy policy and terms of service.