INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login




Remember Me
Forgot Password?
Join Us!

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.
Jobs from Indeed

Link To This Forum!

Partner Button
Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

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

RE: Remove decimals in formula

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

RE: Remove decimals in formula

(OP)
Thanks Swiss,

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

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  

RE: Remove decimals in formula


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

RE: Remove decimals in formula

(OP)
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

RE: Remove decimals in formula

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

RE: Remove decimals in formula

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  

RE: Remove decimals in formula

(OP)
Thanks this worked (with the leading zeros)

G

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close