Jump to content


Click the link below to see the new game I'm developing!


Photo
- - - - -

Limiting records in Listboxes


3 replies to this topic

#1 FrankV

FrankV

    Newbie

  • Members
  • Pip
  • 7 posts

Posted 22 April 2005 - 03:49 PM

Is there anyway to limit the number of records pulled into a listbox. For example, I have 3000 records but it takes to long to load them all in so I only want the 1000 most recent records to be displayed.

Thanks for your help

Frank

#2 CSuarezdelReal

CSuarezdelReal

    Advanced

  • Members
  • PipPipPip
  • 91 posts
  • Gender:Not Telling

Posted 22 April 2005 - 07:06 PM

Hi Frank!

In similar situations, where I want to limit the quantity of records processed I could use a counter in the Default Logic, as #I = 0. In the ARNE logic of the file processed I only would add a condition: #I += 1 IF #=1000 THEN LSEXIT;.

If you only want the most recent records, there should be a date or time stamp as a field in each record processed, so that in an SQL statement you can define an "ORDER BY" qualifier, or get a similar behavior using the SORT fields in the header of the LS.

Those options could not be time-efficient solutions though, so if I had a SQL database, I would use a SQL statement to select the records, using a "pivot" table to get the exact amount of records, without using the counter.

There are very good articles looking in the Internet that explain how to use pivot tables to get that work done via SQL.

Regards,

Claudio Suarez del Real "It is not the strongest of the species that survive, nor the most intelligent, but the ones most responsive to change."


#3 Joseph Bove

Joseph Bove

    ProIV Guru

  • Members
  • PipPipPipPipPip
  • 756 posts
  • Gender:Male
  • Location:Ramsey, United States

Posted 24 April 2005 - 02:01 AM

Frank,

Just a follow up:

In similar situations, where I want to limit the quantity of records processed I could use a counter in the Default Logic, as #I = 0. In the ARNE logic of the file processed I only would add a condition: #I += 1 IF #=1000 THEN LSEXIT;.


Depending of the SQL database, you can incorporate this into the SQL. Among SQL SERVER, Oracle, and PostgreSQL there are commands like LIMIT, TOP, and FIRST that let you specify a number of records. I don't have direct access to my notes right now to specify which command goes with which database.

hth,

Joseph

#4 Wim Soutendijk

Wim Soutendijk

    ProIV Guru

  • Members
  • PipPipPipPipPip
  • 216 posts
  • Gender:Male
  • Location:Netherlands

Posted 25 April 2005 - 11:34 AM

I remember having some problems whith the SELECT TOP statement in a selection cycle
what should work is the following statement:
SQL
SELECT TOP 1000 KEYVAR
FROM FILE
ENDSQL

This will only give you the primairy key of your file, so you will need to read the file again to get al the data fields.



Reply to this topic



  


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

Click the link below to see the new game I'm developing!