Dynamic Where Clause
Marcus, November 16, 2016 - 8:05 am UTC
You can set the where clause in a Forms block at runtime.
Let's assume you have a control block with two items :ctrl.from and :ctrl.to that define the range and a database block for your view. Then build the where string you need like
new_where := 'date_col_in_your_view BETWEEN TO_DATE('''|| TO_CHAR(:ctrl.from,'dd.mm.yyyy') ||''',''dd.mm.yyyy'') AND TO_DATE('''|| TO_CHAR(:ctrl.to,'dd.mm.yyyy') ||''',''dd.mm.yyyy'')';
SET_BLOCK_PROPERTY(<view_block>,DEFAULT_WHERE,new_where);
Then requery the block.
reply
hubab, November 17, 2016 - 4:58 am UTC
thanks alot for your prompt reply. Im amazed and grateful.
Thankyou once again
reply
hubab, November 17, 2016 - 5:13 am UTC
Marcus what do u mean by requery?
Requery
Marcus, November 17, 2016 - 8:59 am UTC
When you set the default where the database block is not updated automatically. Therefore you have to
go_block ('xy');
execute_query();
to refresh the rows.