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

How to use the "left" option?

Status
Not open for further replies.

tuigvlieg

Programmer
Feb 9, 2005
26
NL
I have a database field that is a character field and looks like this 875.127.00.

I want to remove the last 2 zero's from the report. How should I do this?

I have already done this via the format field but it should also be possible via a formula.

Formula used: Left ({tsdsmd.dosvlg},6)

Error message: " string is requested there
 
For some reason Crystal thinks {tsdsmd.dosvlg} is not a string, I assume it is this field which returns 875.127.00

Are you sure you are using the correct field in the formula?

A way round the problem will be to convert to text first so formula will become.

Left (totext({tsdsmd.dosvlg}),6)
but this should not be necessary?

Ian



 
Right-click on the field and select Format Field: see what you've got. If it is a number, you should be able to get rid of the decimal places.

Also check the thousand separator - should it be a full stop rather than a comma? Maybe it is, for your business or national set-up.

Depending on your version of Crystal, you might be able to use an icon to get rid of decimal places, or add them.

For a number, you could also try totext({tsdsmd.dosvlg}), 0) - which means no decimal places. The advantage of doing it this way is that it works on all machines, rather than changing when the report is run by someone with a different set-up.

Check ToText in [Help] - lots of interesting options

[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top