Home » Developer & Programmer » Forms » Problem in a Formula item
Problem in a Formula item [message #187747] Tue, 15 August 2006 06:42 Go to next message
emadbsb
Messages: 334
Registered: May 2005
Location: egypt
Senior Member

Hii All

i have a percentage item field that have a formula column
suppose that formula is
trunc(:VALUE_SUM*100/:GLOBAL.vVALUE,2)


i want if the result of the formual is less than 1 then
the percentage displayed equal to 0


can i make something like that
deccode(trunc(:VALUE_SUM*100/:GLOBAL.vVALUE,2),'<1','0')


Re: Problem in a Formula item [message #188060 is a reply to message #187747] Wed, 16 August 2006 21:48 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
I suggest that you do not display the database field but create a displayed non-database field and populate it using the Post-Query trigger (at the block level).

David
Re: Problem in a Formula item [message #188168 is a reply to message #188060] Thu, 17 August 2006 06:11 Go to previous messageGo to next message
NasirPanwar
Messages: 8
Registered: August 2005
Location: Faisalabad
Junior Member
Hello,

You should make a function and you can put your logic in that function. Simply put the function name instead of your formula in the formula property and you are done.

Regards,

Nasir Mahmood Panwar
Assitant Manager I.T.
Masood Textile Mills Limited (www.masoodtextile.com)
Faisalabad
Pakistan
Re: Problem in a Formula item [message #188181 is a reply to message #188168] Thu, 17 August 2006 06:44 Go to previous message
Maaher
Messages: 7065
Registered: December 2001
Senior Member
Have a look at the 'GREATEST' function:
SQL> select greatest(&yourvalue, 0) x
  2  from   dual
  3  /
Enter value for yourvalue: -1
old   1: select greatest(&yourvalue, 0) x
new   1: select greatest(-1, 0) x

         X
----------
         0

SQL> /
Enter value for yourvalue: 120
old   1: select greatest(&yourvalue, 0) x
new   1: select greatest(120, 0) x

         X
----------
       120

SQL> /
Enter value for yourvalue: -12.3
old   1: select greatest(&yourvalue, 0) x
new   1: select greatest(-12.3, 0) x

         X
----------
         0

SQL>
You could get the job done with decode (and sign), but I feel that this is more obvious Wink

MHE

Previous Topic: the record is shifted up when check mark checked
Next Topic: Global Variables Or Parameter List ?
Goto Forum:
  


Current Time: Tue Dec 03 20:43:30 CST 2024