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

Attribute decimal display

Status
Not open for further replies.

Rambo2292468

IS-IT--Management
Mar 2, 2004
29
US

Hi,

I have an attribute named Quantity. I use the formatting below (backend data is teradata) to display the data with decimal:
ApplySimple(" cast(cast (#0 as decimal(12,3)) as char(12))", [item_required_amount])



From this formatting, it displays the data as follow: 1.000, .000, 1.123. However, my customer is very picky about this. In the case 1.000, she only want to see 1, in the case 0.000, she wants to see 0 only, not decimal. However, in the case backend data has 1.123, she wants to see 1.123.
 
You can try to use a case statement like (syntax NOT checked):

case when (cast(cast (#0 as decimal(12,3)) as char(12)) <> (cast(cast (#0 as decimal(12,3)) as char(12)) then (cast(cast (#0 as decimal(12,3)) as char(12)) else case when (cast(cast (#0 as decimal(12,2)) as char(12)) <> (cast(cast (#0 as decimal(12,1)) as char(12)) then (cast(cast (#0 as decimal(12,2)) as char(12)) else case when (cast(cast (#0 as decimal(12,1)) as char(12)) <> (cast(cast (#0 as decimal(12,0)) as char(12)) then (cast(cast (#0 as decimal(12,1)) as char(12)) else (cast(cast (#0 as decimal(12,0)) as char(12)) end case end case end case end case
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top