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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

View field in Fixed length format

Status
Not open for further replies.

rvasquez

Programmer
Jun 8, 2001
7
0
0
US
How can i make the fields that i use in my report fixed length? I want to be able to see leading "0" for a numeric field (i.e. "1234.00" to fixed length of 9 "000123400") and trailing "Spaces" for Alpha fields (i.e. "Hello World" to fixed length of 25 "Hello World ")
Is there some way that i can create an edit mask so that i can format the fields, so that they will display the data in the way i have described above?

Thanks
R
 
Have a look at the ToText() function with its optional Format String argument.

Cheers,
- Ido
 
ToText works with converting data types ie
ToText(1234.00, "000000000") produces "000001234"
ToText(1234.00, ,2,"","")produces "000123400"
As Ido points out, the Help is your best resource here.
However, to convert "Hello World" to "Hello World ", no change to data type is made. For this, assuming a desired length of 25, use
"Hello World" + Space(25 - Length("Hello World"))
Of course, "Hello World" can be any text string/field not greater than 25 characters.
Malcolm Wynden
Authorized Crystal Engineer
malcolm@wynden.net
 
Thank you both for the great help.
One thing though, one of the fields that i'm reading is from MS SQL and it is defined as Currency, when i do my totext() is defaults a "$". What do i need to do to get rid of this? Am i doing this correct by putting these formuals in Field Exporer > Formula fields and not in the Field Exporer > db Fields, at least i can't figure out how to do it in the Field Exporer > db Fields.
thanks
R
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top