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

Change a number field display 1

Status
Not open for further replies.

FRENCHIEE

MIS
Mar 11, 2003
3
CA
I have a field that maybe negetive so I use the formula "abs(field)" and its displays as "xxxxxx"if I format the field to remove the decimals. I want it to display like this"xx-xxxx" I can't seem to use the picture command on a number field. it does work on a string field. help
 
Dear Frenchiee,

Is the hyphen always in the 3rd position?

If so, try this (it could be more elegant but it gets the job done...):

//begin formula
stringvar f2char := mid(totext({Table.NumField},'#'), 1, 2) & '-';
stringvar rest := mid(totext({Table.NumField},'#'),3, length(totext({Table.NumField})));

f2char & rest
//end formula

Hope that helps,

ro Rosemary Lieberman
rosemary@microflo.com, Microflo provides expert consulting on MagicTSD and Crystal Reports.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top