I am currently using Crystal 10. I am currently writing a report that currently using 2 fields called dept and item#.
Example of these results are:
Dept = 369
Dept = 471
Item# = 1
Item# = 10
Item# = 100
Item# = 1000
I want to concatenate these 2 fields so that the intended result will be 369-0001 ,369-0010, 369-0100 or 369-1000.
Problem is if I just do a simple concatenation of the 2 fields, I get this: 369-1, 369-10, 369-100.
I need the item number to be a full 4 digits with 0's preceding them.
I tried this formula, but the results all end up with decimal values and I can't seem to edit them.
ex: 369.00-0005.00
stringvar CDM := totext({BSYMMCP.MCITM#},0,"");
if len(CDM) = 1
then ({BSYMMCP.MCDEPT}&"-"&"000"&{BSYMMCP.MCITM#})
else
if len(CDM) = 2
then ({BSYMMCP.MCDEPT}&"-"&"00"&{BSYMMCP.MCITM#})
else
if len(CDM) = 3
then ({BSYMMCP.MCDEPT}&"-"&"0"&{BSYMMCP.MCITM#})
else
if len(CDM) = 4
then ({BSYMMCP.MCDEPT}&"-"&{BSYMMCP.MCITM#})
Suggestions...
Example of these results are:
Dept = 369
Dept = 471
Item# = 1
Item# = 10
Item# = 100
Item# = 1000
I want to concatenate these 2 fields so that the intended result will be 369-0001 ,369-0010, 369-0100 or 369-1000.
Problem is if I just do a simple concatenation of the 2 fields, I get this: 369-1, 369-10, 369-100.
I need the item number to be a full 4 digits with 0's preceding them.
I tried this formula, but the results all end up with decimal values and I can't seem to edit them.
ex: 369.00-0005.00
stringvar CDM := totext({BSYMMCP.MCITM#},0,"");
if len(CDM) = 1
then ({BSYMMCP.MCDEPT}&"-"&"000"&{BSYMMCP.MCITM#})
else
if len(CDM) = 2
then ({BSYMMCP.MCDEPT}&"-"&"00"&{BSYMMCP.MCITM#})
else
if len(CDM) = 3
then ({BSYMMCP.MCDEPT}&"-"&"0"&{BSYMMCP.MCITM#})
else
if len(CDM) = 4
then ({BSYMMCP.MCDEPT}&"-"&{BSYMMCP.MCITM#})
Suggestions...