Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Populating with repeating values

Status
Not open for further replies.

LinPro

Programmer
Jun 25, 2003
120
US
Hi

I am trying to fill in a field with repeating 0s?

Is the a function in Crystal Report that can handle this?

Lin
 
replicate string should do it

{feild} = 500

replicatestring("0",8-len(
totext(
{feild}
*100,"#")
))
&
totext(
{feild}
*100,"#")

results in 00000500

I added the len function because typically when I need to do what your asking the reult has to be a certain length

_____________________________________
Crystal Reports XI Developer Version
Intersystems Cache 5.X ODBC connection

 
//{feild} = 500

replicatestring("0",8-len(
totext(
{feild}
*100,"#")
))
&
totext(
{feild}
*100,"#")

//results in 00000500

and yes i know I spelled field wrong ;)

_____________________________________
Crystal Reports XI Developer Version
Intersystems Cache 5.X ODBC connection

 
thanks.... I was looking for a built in function.
 
replicatestring is a built in function

_____________________________________
Crystal Reports XI Developer Version
Intersystems Cache 5.X ODBC connection

 
Depending upon what you are doing, you could potentially use the following:

totext({table.number},"00000000")

...which would pad with leading zeros to create the length specified by the number of zeros (which you can adjust as necessary).

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top