Home » Developer & Programmer » Forms » HOW TO SORT BY DESCENDING ORDER IN SET BLOCK PROPERTY ORDER BY
HOW TO SORT BY DESCENDING ORDER IN SET BLOCK PROPERTY ORDER BY [message #242960] Tue, 05 June 2007 11:00 Go to next message
jtc103
Messages: 19
Registered: May 2007
Junior Member
Is this possible?

I have a sort button on top of each of my columns in my detail block. What I want to do is for the user to click on the button and the details will be sorted ascending or descending order by that column. right now I can do it ascending as this is the default. I am not sure how to do it in descending order.

Re: HOW TO SORT BY DESCENDING ORDER IN SET BLOCK PROPERTY ORDER BY [message #243047 is a reply to message #242960] Tue, 05 June 2007 16:12 Go to previous messageGo to next message
Littlefoot
Messages: 20895
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
I'd use the DESC keyword. Something like this:
set_block_property('dept', order_by, 'dname desc');
Re: HOW TO SORT BY DESCENDING ORDER IN SET BLOCK PROPERTY ORDER BY [message #243182 is a reply to message #242960] Wed, 06 June 2007 06:33 Go to previous messageGo to next message
jtc103
Messages: 19
Registered: May 2007
Junior Member
i pass a variable containing the column name and i get an error when i try to add the word desc after

so for example, my variable is v_orderyby, I tried doing

v_orderby := 'det_col1';

SET_BLOCK_PROPERTY('blk_details',ORDER_BY, v_orderby);

that works but only in the default ascening order.
Re: HOW TO SORT BY DESCENDING ORDER IN SET BLOCK PROPERTY ORDER BY [message #243188 is a reply to message #243182] Wed, 06 June 2007 07:15 Go to previous messageGo to next message
mudabbir
Messages: 235
Registered: April 2006
Location: Kuwait
Senior Member

try this...

v_orderby := 'det_col1 desc';

SET_BLOCK_PROPERTY('blk_details',ORDER_BY, v_orderby);
Re: HOW TO SORT BY DESCENDING ORDER IN SET BLOCK PROPERTY ORDER BY [message #243190 is a reply to message #242960] Wed, 06 June 2007 07:26 Go to previous messageGo to next message
jtc103
Messages: 19
Registered: May 2007
Junior Member
I tried that already, and I get an ORA-06502 error.

I want to mention though that det_col1 is not the actual column name but my item name (I need to do this as I am populating my columns dynamically using the QUERY SOURCE as FROM CLAUSE.
Re: HOW TO SORT BY DESCENDING ORDER IN SET BLOCK PROPERTY ORDER BY [message #243198 is a reply to message #243190] Wed, 06 June 2007 07:56 Go to previous messageGo to next message
Littlefoot
Messages: 20895
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
And how exactly are we supposed to know what you are doing if you don't tell us? This is a whole new world of information!
Re: HOW TO SORT BY DESCENDING ORDER IN SET BLOCK PROPERTY ORDER BY [message #243203 is a reply to message #243190] Wed, 06 June 2007 08:02 Go to previous messageGo to next message
mudabbir
Messages: 235
Registered: April 2006
Location: Kuwait
Senior Member

I have written this code in 'WHEN-BUTTON-PRESSED' trigger on the button on top of a column in my form to sort it accordingly

Declare
	chk varchar2(100);
Begin
	if :global.chk_stat  = 1 then
		chk:= 'status'; -- [B][COLOR=red]Status is a column in block1[/COLOR][/B]
		SET_BLOCK_PROPERTY('BLOCK1',ORDER_BY,chk);
		go_block('block1');
		Execute_query(all_records);
		:global.chk_stat := 2;
	Else
		chk:= 'status desc';
		SET_BLOCK_PROPERTY('BLOCK1',ORDER_BY,chk);
		go_block('block1');
		Execute_query(all_records);
		:global.chk_stat := 1;
	End If;
End;
Re: HOW TO SORT BY DESCENDING ORDER IN SET BLOCK PROPERTY ORDER BY [message #243204 is a reply to message #242960] Wed, 06 June 2007 08:04 Go to previous messageGo to next message
jtc103
Messages: 19
Registered: May 2007
Junior Member
It was working with the default ascending order, does it being a dynamic column name restrict it from working in descending then?
Re: HOW TO SORT BY DESCENDING ORDER IN SET BLOCK PROPERTY ORDER BY [message #243206 is a reply to message #243203] Wed, 06 June 2007 08:09 Go to previous messageGo to next message
jtc103
Messages: 19
Registered: May 2007
Junior Member
Hi mudabbir,

Thanks for the input, I will try that. Is your status set to database column in its properties?
Re: HOW TO SORT BY DESCENDING ORDER IN SET BLOCK PROPERTY ORDER BY [message #243209 is a reply to message #243206] Wed, 06 June 2007 08:12 Go to previous messageGo to next message
mudabbir
Messages: 235
Registered: April 2006
Location: Kuwait
Senior Member

if it doesnt work. Try and explain a little more in detail. I can try and work out something for you.

Mudabbir
Re: HOW TO SORT BY DESCENDING ORDER IN SET BLOCK PROPERTY ORDER BY [message #243228 is a reply to message #242960] Wed, 06 June 2007 09:22 Go to previous messageGo to next message
jtc103
Messages: 19
Registered: May 2007
Junior Member
Mudabbir,

got it to work! i had to increase the size of my variable and it worked fine. thanks very much!
Re: HOW TO SORT BY DESCENDING ORDER IN SET BLOCK PROPERTY ORDER BY [message #243410 is a reply to message #242960] Thu, 07 June 2007 04:13 Go to previous message
wency
Messages: 450
Registered: April 2006
Location: Philippines
Senior Member

Only if you read the description of ORA-06502.. Laughing
Previous Topic: select error: in forms6i
Next Topic: Passing control to another window.
Goto Forum:
  


Current Time: Mon Dec 05 21:05:30 CST 2016

Total time taken to generate the page: 0.19281 seconds