Discussion:
Paging with dbx
(too old to reply)
lowmax
2008-06-10 13:30:57 UTC
Permalink
Is there any method etc. implemented DBX4 how I can easyly realize
'Paging'for dbgrids ?

I want to load only the visible Data in a DBDrid.
If I use the navigator, then the needed Data should be loaded.
I don't want do do that in the DBGrid!!

Has anyone an idea how I can do this?

Thx!
Bill Todd [TeamB]
2008-06-10 13:51:44 UTC
Permalink
This post might be inappropriate. Click to display it.
lowmax
2008-06-10 14:29:09 UTC
Permalink
Post by Bill Todd [TeamB]
When you use dbExpress the data is buffered in memory by the
ClientDataSet. The DBGrid is just a data aware control that displays
data from the dataset it is connected to.
It would help if you explained what you are trying to accomplish or
what problem you are trying to solve.
I try to explain it with an Example:

1. I have a table with 1000 Customers

2. My DBGRid shows only 20 cols at a time

3. When I build an sample Application then the hole table will be loaded
in the grid, that takes to much time to load the table im memory and
display all in the dbgrid.

So it was better when only 20 cols are loaded in memory (CDS) and
displayed in the grid. If for example the the nativator ist clicked
'next' then only one col is loaded, because the grid even shows only 20
cols for the user. So I would realize this not in the ClientDataSet but
in the SQL-Query, but how?

I hope that helps!
Bill Todd [TeamB]
2008-06-10 16:28:46 UTC
Permalink
Post by lowmax
3. When I build an sample Application then the hole table will be
loaded in the grid, that takes to much time to load the table im
memory and display all in the dbgrid.
That is bad client/server application design. Besides, no user wants to
scroll through 1000 records looking for the one they want. Normal
client/server design is to start the user with a screen that does not
show any data and prompt the user to enter some selection criteria. The
selection criteria should limit the number of rows returned to no more
than 100.
--
Bill Todd (TeamB)
lowmax
2008-06-10 21:28:12 UTC
Permalink
Post by Bill Todd [TeamB]
Post by lowmax
3. When I build an sample Application then the hole table will be
loaded in the grid, that takes to much time to load the table im
memory and display all in the dbgrid.
That is bad client/server application design. Besides, no user wants to
scroll through 1000 records looking for the one they want. Normal
client/server design is to start the user with a screen that does not
show any data and prompt the user to enter some selection criteria. The
selection criteria should limit the number of rows returned to no more
than 100.
Maybe a bad design, but my client will have the data in a grid view.
When I could use 'Paging' the grid will only get 20 records at time and
the design will go better. So is 'paging' already supported with DBX4?

lowmax
Bill Todd [TeamB]
2008-06-10 22:42:34 UTC
Permalink
No, there is no built-in paging. What you are really asking for is a
way to break the time required to load all of the data into the CDS
into smaller chunks so it is not so noticeable. You can use the
ClientDataSet.PacketRecords property to load the data into the CDS
incrementally as the user scrolls through the data. The disadvantage of
this is that you will hold the query open on the server for a long time
this consuming server resources and reducing scalability.
--
Bill Todd (TeamB)
lowmax
2008-06-11 07:57:11 UTC
Permalink
Post by Bill Todd [TeamB]
No, there is no built-in paging. What you are really asking for is a
way to break the time required to load all of the data into the CDS
into smaller chunks so it is not so noticeable. You can use the
ClientDataSet.PacketRecords property to load the data into the CDS
incrementally as the user scrolls through the data. The disadvantage of
this is that you will hold the query open on the server for a long time
this consuming server resources and reducing scalability.
Thank you very much. That helps me!

So when I understand right than DBX cannot create state statements like

'select first 5 skip 10 * from cusomers'

So I have to implement 'paging' manually in the code combined with the
ClientDataset.PacketRecords property.



lowmax
Bill Todd [TeamB]
2008-06-11 13:17:45 UTC
Permalink
Post by lowmax
'select first 5 skip 10 * from cusomers'
SQL is implemented by the database server. The SQL dialect has nothing
to do with Delphi or dbExpress. Consult the documentation for your
database server to see if it supports the SQL standard ROWS syntax.
--
Bill Todd (TeamB)
Loading...