cancel
Showing results for 
Search instead for 
Did you mean: 

How to apply Format mask in crystal reports

former_member373051
Participant
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

former_member183750
Active Contributor
0 Kudos

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 FormulaFieldDefinition

Private 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

Answers (0)