cancel
Showing results for 
Search instead for 
Did you mean: 

Replace numeric to astirisk

former_member541807
Active Contributor
0 Kudos

hello all,

i have the ff. requirement: let say this is the content of my DB field

 

"Some text in this text field, Some text in this text field, Some text in this text field, Some text in this text field, Some text in this text field, Some text in this text field, Some text in this text field,

1,234,456.00"

 

now is it possible to display the numeric characters into asterisk like instead of displaying 1,234,456.00 it will display *,***,***.**  or any character.

any suggestion or a workaround...

 

thanks & advance    

Fidel

Accepted Solutions (1)

Accepted Solutions (1)

nscheaffer
Active Contributor
0 Kudos

As an example I created a formula in Basic Syntax called NoNumbers where TestCol is the database field that has the numbers that are to be replaced with asterisks.  Basically I am looping through the string of data in one character at a time and replacing that character with an asterisk if it is a number.

Dim intLength as Number

Dim intCurrentPosition as Number

Dim strCurrentCharacter as String

Dim strNewText as String

intLength = Len({Command.TestCol})

intCurrentPosition = 1

Do While intCurrentPosition <= intLength

    strCurrentCharacter = Mid ({Command.TestCol}, intCurrentPosition, 1)

    If IsNumeric (strCurrentCharacter) Then

        strNewText = strNewText + "*"

    Else

        strNewText = strNewText + strCurrentCharacter

    End If

    intCurrentPosition = intCurrentPosition + 1

Loop

formula = strNewText

Here is a screenshot of my Formula Editor window for NoNumbers so you can see it in the appropriate context.

I hope this helps you out.

Noel

former_member541807
Active Contributor
0 Kudos

Hi Noel Scheaffer,

exactly the way i want to display the data in my Crystal Report. it works Great!

thank you very much.

Fidel


Answers (0)