How to restric the search query max read of 100 rows ?

Author: jayesh.g.patel@accenture.com (Jayesh82mscit)

Hi All, In order to provide optimized experience to the customer on the search page, there is a need of restricting the RETRIVAL result from Database (through Uniface code) based on the user input SEARCH criteria. Can the retrieval criteria be controlled to fetch only lets say 100 rows only ? Please note that we don't want to manipulate the result set by any customized code of looping through and discard beyond 100 records etc. Would like to explore if any Uniface function available to achieve this requirement ? Thanks, Jayesh

2 Comments

  1. Hello Jayesh In the read trigger of the involved entity options can be specified read options "maxhits=100" Under downloads -> Community samples there is also a sample how you could use database paging.   Kind regards Peter


    Author: PBeugel (peter.beugel@uniface.com)
  2. Hi Jayesh, In addition to Peter's option - sometimes the version of the Uniface driver doesn't support maxhits - or the dbms you're using doesn't support it at all. To get around that problem, I set up a component variable $RECORD_COUNT$, and in the READ trigger of the specific entity I have this;

    if ($RECORD_COUNT$ > 0 & $totocc("%%$entname") = $RECORD_COUNT$ ) return(0) endif read

    I guess one could argue - should I have used -8 as the return value?? I decided not to step on the Uniface status codes... Cool Regards, Knut


    Author: Knut (knut.dybendahl@gmail.com)