PDA

Click to See Complete Forum and Search --> : [RESOLVED] Concatenating 2 integers Crystal


Besoup
Dec 14th, 2006, 01:40 PM
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!

Besoup
Dec 14th, 2006, 01:55 PM
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.

brucevde
Dec 14th, 2006, 03:07 PM
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.

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.

Besoup
Dec 14th, 2006, 03:16 PM
awesome, thanks man!