Search code examples
c#crystal-reports

How to format integer data source without comma then put star before and after the column in crystal reports?


I have order id column and i need to put star before and after the integer value , but first i need to remove comma in crystal reports what i did :

1- insert text box and write **

2- insert the order id column from the table

3- formar the object and keep it without comma (1122) format

4- when I need to drag and drop the order id field between the ** its not accept .

5- How can I insert * before and * after the integer and after format the number.

6- order id value by default like this example :

2,000,000,180

I need to remove the comma and keep it like this

2000000180

then add star before and after*2000000180*

and read always from database order id value .

NOTE :

I can drag and drop the integer order id column direct from field explorer to the text box between the stars but if i drop the column in the work area section I cannot then put it between the atars .

How to solve this issue and put stars after format the object ?


Solution

  • 1- In crystal reports Right click formula field then select New .

    2- Type the name of your formula.

    3- Type the following code under crystal syntax :

    stringvar replaceid := Replace("2,000,000,180",",",""); 
    stringvar Result := "*" + replaceid + "*"
    

    4- Replace command and this syntax will remove the comma .

    5- The result will be *2000000180*