Results 1 to 4 of 4

Thread: [RESOLVED] Concatenating 2 integers Crystal

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Nov 2001
    Location
    Mass USA
    Posts
    1,674

    Resolved [RESOLVED] Concatenating 2 integers Crystal

    hello, I need to join 2 integers together as if they were strings.

    ie. 10000 + 01 = 1000001

    also how would I format it so a 1 would dispay 01? thanks!

  2. #2

    Thread Starter
    Frenzied Member
    Join Date
    Nov 2001
    Location
    Mass USA
    Posts
    1,674

    Re: Concatenating 2 integers Crystal

    I did it with the following but I am sure there is probably a better way

    replace(replace(totext({PL_Shipping_Template.PL_Header_Invoice_Number}),".00","") & "-" & totext({PL_Shipping_Template.PL_Header_BO_Number},"00"),",","")

    for some reason my invoice_number was adding .00 to the end that is why there are 2 replace calls.

  3. #3
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758

    Re: Concatenating 2 integers Crystal

    All numbers in Crystal are decimal values. When converting numbers to text, the second argument can also be used to indicate the number of decimal places to include (if you include a format in the second argument - decimal places argument becomes the third argument).
    The third (or fourth) argument lets you overide the thousand separator.

    This formula returns a number. You can then Format that number using the normal means.

    Code:
    ToNumber (ToText (PL_Shipping_Template.PL_Header_Invoice_Number, 0,'' ) + 
                    ToText (PL_Shipping_Template.PL_Header_Invoice_Number, "00",0,'')
                  )
    It wasn't clear if you wanted the Formula to return a number or a string. If string add another ToText around the above formula.
    Last edited by brucevde; Dec 14th, 2006 at 04:17 PM.

  4. #4

    Thread Starter
    Frenzied Member
    Join Date
    Nov 2001
    Location
    Mass USA
    Posts
    1,674

    Re: Concatenating 2 integers Crystal

    awesome, thanks man!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width