Zero Fill Numeric Field w/Decimal

Meeting place for R&R customers and clients to share tips and ideas. Post your questions, messages or problems here.
Post Reply
jaem
Posts: 6
Joined: Tue Oct 10, 2017 12:44 pm

Zero Fill Numeric Field w/Decimal

Post by jaem » Fri Nov 02, 2001 2:38 pm

I need to zero fill a 12 character numeric fixed field with a decimal(000000079.17 EXAMPLE) May contain negative amounts like(-00000079.17 EXAMPLE) ____HELP!!!!!!!!!!__ __Jae Markham__Programmer/Analyst__College of the Sequoias__Visalia, CA 93277

John_McDonald_(Guest)
Posts: 9
Joined: Tue Oct 10, 2017 12:44 pm

=> RE: Zero Fill Numeric

Post by John_McDonald_(Guest) » Fri Nov 02, 2001 3:40 pm

create field with calculation below where numer is the field name____iif(numer<0,"-","0") right("00000000000" ltrim(str(abs(numer),11,2)),11)

John_McDonald_(Guest)
Posts: 9
Joined: Tue Oct 10, 2017 12:44 pm

=> RE: Zero Fill Numeric Field w/D

Post by John_McDonald_(Guest) » Fri Nov 02, 2001 3:44 pm

Sorry about that, the last post converted my formula to smileys____replace fielda with iif(numer<0,"-","0") right("00000000000" ltrim(str(abs(numer),11,2)),11) all

kfleming
Posts: 5795
Joined: Tue Oct 10, 2017 12:44 pm

=> Zero Fill Numeric Field w/Decimal

Post by kfleming » Fri Nov 02, 2001 3:48 pm

This is ridiculous, ____replace fielda with iif(numer<0,"-","0" ) + right("00000000000"+ltrim(str(abs(numer),11,2)),11) all

John_McDonald_(Guest)
Posts: 9
Joined: Tue Oct 10, 2017 12:44 pm

==> RE: Zero Fill Numeric Field w/D

Post by John_McDonald_(Guest) » Fri Nov 02, 2001 3:48 pm

A calculated field with expression:____IIF(num<0,__"-" replicate("0",11-len(ltrim(str(abs(num),12,2))))-ltrim(str(abs(num),12,2))__,__replicate("0",12-len(ltrim(str(abs(num),12,2))))-ltrim(str(abs(num),12,2)))____might be one way to get there.____Kathleen__R&R Support

Post Reply