Skip to Content
avatar image
Former Member

How to apply Format mask in crystal reports

Dear Friends,

                    How to apply Format mask in crystal reports dynamically,

we have diff type of clients from diff countries we need to apply format mask for Amount field dynamically.

for your reference bellow are types of formats we are using,

123456789.00

123456789.000

12,34,56,789.00

123,456,789.000

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Jul 31, 2012 at 03:21 PM

    Knowing what format you want, pass in the correct structure to a formula.

    E.g.;

    If requirement1 is 123,456,789.000, then pass the following to the formula:

    Picture ({customer.number}, 'xxx,xxx,xxx.xxx')

    To pass in a formula you'd use code along the following lines:

    Imports CrystalDecisions.CrystalReports.Engine

    Imports CrystalDecisions.Shared
    Public Class Form1
    Inherits System.Windows.Forms.Form
    Dim Report As New CrystalReport1()
    Dim FormulaFields As FormulaFieldDefinitions
    Dim FormulaField As FormulaFieldDefinitionPrivate Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    FormulaFields = Report.DataDefinition.FormulaFields
    FormulaField = FormulaFields.Item(0)
    FormulaField.Text = "[formula text]"
    CrystalReportViewer1.ReportSource = Report
    End Sub

    For more information see the SAP Crystal Reports .NET SDK Developer Guide. Also, don't forget to use the search box in the top right corner of this web page. Fair amount of info there. E.g.:

    KB - 1215543 - How to format strings and numbers using the Picture function

    - Ludek

    Follow us on Twitter

    Got Enhancement ideas? Try the SAP Idea Place

    Share Your Knowledge in SCN Topic Spaces

    Add comment
    10|10000 characters needed characters exceeded