Re: Forms: How to let the user choose the 'order by'

From: Tapio Luukkanen <vtl_at_hemuli.tte.vtt.fi>
Date: 1997/04/22
Message-ID: <wau3kysurx.fsf_at_hemuli.tte.vtt.fi>#1/1


aut7b1p_at_sbs.de writes:

> I'm wondering that I can't find a way to make it possible to let the user
> change the order-by clause.
 

> I'm not a PL/SQL-novice, but Oracle Forms is new to me.
>
> Are there any code-examples, free librarys, good books (I've already read
> 'Oracle Developer / 2000 -Handbook from Oracle Press) or just ideas that
> can help ?

Warning: the following is untested and may apply only to Forms 3.0.

Use a pre-query trigger, and order your fields within the block so, that some non-null base table field is last.

In the pre-query trigger you concatenate your ORDER BY -clause to this field, as below:

  • We suppose that :yht.yht_uusin is always NON-NULL,
  • and it is the last base table field in current block. IF :ask.ordering = 'N' THEN -- no specific ordering :yht.yht_uusin := '=yht_uusin'; -- could be left NULL, too... ELSE ordering_fields := 'yht_field1,yht_field2 desc,yht_field3'; :yht.yht_uusin := '=yht_uusin) ORDER BY ('||ordering_fields; END IF;
  • Forms will provide the missing right parenthesis..........^

Hope this helps,

  Tapio L. Received on Tue Apr 22 1997 - 00:00:00 CEST

Original text of this message