trimming and concenating two fields with CR 10

Posted on 2007-07-25
Last Modified: 2008-02-01
Using Crystal 10, I am trying to take 2 number fields, each 8 characters long, and trim 4 extra 0's off the right side, then concenate them together with a hyphen between to form an account number string. Example:
field 1: 21000000
field 2: 0210000
resultant field: 2100-021
Question by:wiseman4250
    LVL 13

    Expert Comment

    write a formula:

    {table.field1}[1 to len({table.field})-4}+'-'+{table.field2}[1 to len({table.field})-4}

    LVL 13

    Expert Comment

    rather this

    {table.field1}[1 to (len({table.field})-4)}+'-'+{table.field2}[1 to (len({table.field})-4)}

    LVL 100

    Accepted Solution

    If they are truly 8 characters (your example isn't)

    Left({table.field1},4) & "-" & Left({table.field2},4)

    If they can be variable length then gary's formula or if you prefer

    Left({table.field1},Length({table.field1}-4) & "-" & Left({table.field2},length({table.field2}-4)


    Author Comment

    thanks for the help.  I had trouble with syntax errors on the first two options.
    LVL 100

    Expert Comment

    Glad i could help


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
    Hi, In my previous Article  ( discussed some basic understanding of Microstrategy that how we can get in Intro of Microstrategy (MSTR). Now it's tim…
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now