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

Remove decimals in formula 4

Status
Not open for further replies.

gogopoppy

Instructor
Joined
Mar 6, 2005
Messages
114
Location
CA
Hi,

My formula is the following DatePart('ww',{mydatefield}) which shows me my weeks.

However I get 3.00 and I want 3 instead. I can't seem to use the decimal buttons to remove the zeros.

Can anyone help me figure this out.

Any help would be greatly appreciated.

Tx

G
 
Try This
totext(DatePart('ww',{mydatefield}),0,"")
 
Thanks Swiss,

It worked except when I group by the formula it sorts week 10, 11, etc before week 2.

Any ideas

Tx

G
 
If you are listing the formula on your report, then you should be able to right click on the formula -> format field and apply the format you want such as -1123 which does not have the decimals
 

i think you can also use "Replace" to strip the decimal part,
 
Thanks KsKid,

Yeah that worked. The decimal buttons were greyed out but when I right clicked it I could format it to remove the decimal places.

The only thing which is minor is that I still get decimals in the group tree (not on the actual report group names which no longer have decimals). However I can live with that (I didn't get the decimals anywhere with the totext however the sorting was a problem).

Tx again

G
 
If the decimalised group tree figures are annoying you then you can amend them easily.

Right click on the group and choose change group.
Click on Options -> Customise -> Use formula as...
Click on the x+2 button and enter:

val(totext({table.field},0,''))

Or if a string is required then just

totext({table.field},0,'')


'J



CR8.5 / CRXI - Discovering the impossible
 
Or
Code:
totext(DatePart('ww',{mydatefield}),"00")
That will give you leading zeros.

[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
Thanks this worked (with the leading zeros)

G
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top