Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login




Remember Me
Forgot Password?
Join Us!

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.
Jobs from Indeed

Link To This Forum!

Partner Button
Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

omega1983 (Programmer) (OP)
21 Dec 04 15:18
I am using crystal 8.0 (with access to 9.0).  
I have an account number as follows 0-62152. I also have a number such as 045842.  If the number has a dash I want to show the number without the dash (ie 0-62152, becomes 062152) Is there a quick and dirty way to do this.
Helpful Member!  vidru (Programmer)
21 Dec 04 15:24
Yep:

Replace({Table.Field},"-","")

-dave
omega1983 (Programmer) (OP)
21 Dec 04 15:37
I tried this formula  
Replace ({gifts_full.giftacctno},"-",""). The only problem is that it erases everything so nothing shows.  I tried a variation of the formula
Replace ({gifts_full.giftacctno},"-","0"). It then shows the account number without a dash but with an extra zero. Also this field is a string, not a number.  Does that change anything?
omega1983 (Programmer) (OP)
21 Dec 04 15:38
I tried this formula  
Replace ({gifts_full.giftacctno},"-",""). The only problem is that it erases everything so nothing shows.  I tried a variation of the formula
Replace ({gifts_full.giftacctno},"-","0"). It then shows the account number without a dash but with an extra zero. Also this field is a string, not a number.  Does that change anything?

If you have responded to this already, disregard
lbass (TechnicalUser)
21 Dec 04 17:40
There is a problem with the replace function in 8.0 that was corrected in 8.5. However, I believe there might be a workaround, and I thought Dave (vidru) might have been the one who knew what it was...I myself don't remember.

-LB
vidru (Programmer)
21 Dec 04 22:54
I'm running 8.5 and 9.0 here, so I can't test with 8 anymore.  If you've got access to 9, it should work without any problems there.  Unfortunately, if there is a "clean" workaround for 8.0, I don't know what it is.

Here's a "dirty" workaround:

NumberVar i;
StringVar out;
for i := 1 to Len({Table.Field}) do(
  if {Table.Field}[i] <> "-" then
    out := out + t[i];);
out;

-dave
lbass (TechnicalUser)
21 Dec 04 23:37
Looks good to me, Dave*, and it works in 8.0--except I think you meant:

NumberVar i;
StringVar out;
for i := 1 to Len({table.field}) do(
  if {table.field}[i] <> "-" then
    out := out + {table.field}[i];);
out;

-LB
vidru (Programmer)
22 Dec 04 0:52
Ah, yes... thanks for the assist, LB.  I had tested with a string variable named "t".

-dave

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close