Home » Developer & Programmer » Forms » Order by Current Month (Form Builder 6i)
Order by Current Month [message #492393] Sun, 30 January 2011 22:59 Go to next message
theowais
Messages: 75
Registered: October 2009
Location: Multan
Member
Hi Experts,

A form has date of birth column.

Date of birth should be displayed according to current month.

Example:
01-jan-1980
01-feb-1975
01-mar-1970

Required:
Let current month is feb then
01-feb-1975
01-mar-1970
01-jan-1980

What should be done?
Re: Order by Current Month [message #492394 is a reply to message #492393] Sun, 30 January 2011 23:29 Go to previous messageGo to next message
Michel Cadot
Messages: 68684
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
order by mod(extract(month from birth)-extract(month from sysdate)+12,12)

Regards
Michel
Re: Order by Current Month [message #492424 is a reply to message #492394] Mon, 31 January 2011 02:13 Go to previous messageGo to next message
theowais
Messages: 75
Registered: October 2009
Location: Multan
Member
Thanks for your reply

CODE:
mod(extract(month from birth)-extract(month from sysdate)+12,12)

The above code is placed in Order By clause, No Result.

Please Explain...
Re: Order by Current Month [message #492426 is a reply to message #492424] Mon, 31 January 2011 02:24 Go to previous messageGo to next message
Michel Cadot
Messages: 68684
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
I don't know about Forms, but this clause works in SQL.
Maybe your old Forms version does not know "extract" function, in this case use:
to_number(to_char(birth,'MM'))

And maybe you have not a column named "birth".

Regards
Michel

[Updated on: Mon, 31 January 2011 02:25]

Report message to a moderator

Re: Order by Current Month [message #492429 is a reply to message #492426] Mon, 31 January 2011 03:05 Go to previous messageGo to next message
theowais
Messages: 75
Registered: October 2009
Location: Multan
Member
Thanks for your reply

CODE:
to_number(to_char(birth,'MM'))

The above code is placed in Order By clause,
It is working for displaying records 1...12 month not for according to current month.
Re: Order by Current Month [message #492430 is a reply to message #492429] Mon, 31 January 2011 03:21 Go to previous message
Michel Cadot
Messages: 68684
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
I meant replace "EXTRACT..." by "TO_NUMBER(TO_CHAR..." in the expression I first gave, NOT to use just that.

Regards
Michel
Previous Topic: Main Menu
Next Topic: Execute Procedure using Forms Personalization
Goto Forum:
  


Current Time: Mon Sep 16 13:07:53 CDT 2024