## Remove decimals in formula

## Remove decimals in formula

(OP)

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

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

## RE: Remove decimals in formula

totext(DatePart('ww',{mydatefield}),0,"")

## RE: Remove decimals in formula

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

Any ideas

Tx

G

## RE: Remove decimals in formula

## RE: Remove decimals in formula

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

## RE: Remove decimals in formula

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

## RE: Remove decimals in formula

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

## RE: Remove decimals in formula

## CODE

Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10

## RE: Remove decimals in formula

G