Board index » delphi » Desperate for help...What am I missing?

Desperate for help...What am I missing?

Why not... make the date list from a query of relelvent dates so you
make a sub table so you end up with a relation such as

Table 1                                 Table 2

Product 1                               Date 1
Product 2
Product 3                               Date 2
Product 4                               Date 3

This should help remove your problem of extra repeated dates

On Tue, 14 Sep 1999 15:34:57 +0200, Travis Elkins

Quote
<tra...@chidera.no.spam.com> wrote:
>Hello,

>I have nearly reached the end of my rope.  I am desperately trying to
>put together a simple application demonstrating a new control that will
>be used as a part of our management information services.

>Here's the basics...I've built a control that is to act as a daily
>planner.  We have a Lotus Notes database that has all sorts of
>information about our Help Desk system, including open cases and various
>case information.  I have built this control so that as the person
>scrolls through the data -- using TDBNavigator and TDBGrid, for example
>-- the daily planner updates itself.  It automatically switches to
>indicate the due date of the selected case, and then populates the
>control with all cases from that date.

>Here's how I do it...Following Ray's -- of Raize Software -- advice, I
>define my own data source.  Then, on various events, I call a
>DataChanged procedure.  This procedure extracts the date of the new
>record and updates my control's date property.  When the date is
>changed, I do the following:

>     Get a bookmark
>     Filter the data set using the new date
>     Cycle through any existing records and store certain
>     information internally
>     Turn off the filter
>     Set the bookmark

>Granted, this may not be the best solution (I'm open to any
>suggestions), but it works fine...up to a point.

>Trouble occurs at a very strange place.  Using TDBGrid, I can follow the
>data and see which record I'm supposed to be on.  The field that I look
>at that contains a date is called Deadline.  As long as there aren't too
>many records in a row with the same value in Deadline, then all's fine.
>But as soon as there are too many, then the Access Violation fairy
>appears.  What I mean is this....If five records are visible in the
>TDBGrid control, then for the most part, the cursor is on the record in
>the middle -- or the third one -- as I press the Next button on the
>TDBNavigator control.  However, when two records share the same value in
>the Deadline field, then instead of moving all the records up and the
>cursor indicator staying in the middle, it drops down one, so that it
>now sits on the fourth visible record.  If there are only two in a row,
>then it goes back to "normal" behavior after this, but, if there are
>more with the same value, then the arrow moves to the fifth.  On
>pressing the Next button when the arrow is on the fifth (or last if the
>DBGrid size is different), then I receive an access violation.  I can
>NOT figure this out.

 

Re:Desperate for help...What am I missing?


When you turn off filtering does the code do a table refresh?

Re:Desperate for help...What am I missing?


Liz,

Thanks for your reply.

I would like to say that I'm not quite sure that I understand your
suggestion.  I assume that by Product, you mean Case.  We are working with
requests, or cases, in our Help Desk system.

If I understand you, you may be saying that I should use a query to retrieve
the valid dates first.  Then, I should search table with the cases based on
whatever record is selected in the date table.  Is this what you're saying?
If it is, then it sounds like a possible solution.  My next question would be
about suggestions for a way to implement this -- as generically as possible
-- with a single Day Planner control.  Any ideas?  :-)

Thanks again for your reply.  I look forward to hearing back from you.

Travis

Quote
Liz Kimber wrote:
> Why not... make the date list from a query of relelvent dates so you
> make a sub table so you end up with a relation such as

> Table 1                                 Table 2

> Product 1                               Date 1
> Product 2
> Product 3                               Date 2
> Product 4                               Date 3

> This should help remove your problem of extra repeated dates

> On Tue, 14 Sep 1999 15:34:57 +0200, Travis Elkins
> <tra...@chidera.no.spam.com> wrote:

> >Hello,

> >I have nearly reached the end of my rope.  I am desperately trying to
> >put together a simple application demonstrating a new control that will
> >be used as a part of our management information services.

> >Here's the basics...I've built a control that is to act as a daily
> >planner.  We have a Lotus Notes database that has all sorts of
> >information about our Help Desk system, including open cases and various
> >case information.  I have built this control so that as the person
> >scrolls through the data -- using TDBNavigator and TDBGrid, for example
> >-- the daily planner updates itself.  It automatically switches to
> >indicate the due date of the selected case, and then populates the
> >control with all cases from that date.

> >Here's how I do it...Following Ray's -- of Raize Software -- advice, I
> >define my own data source.  Then, on various events, I call a
> >DataChanged procedure.  This procedure extracts the date of the new
> >record and updates my control's date property.  When the date is
> >changed, I do the following:

> >     Get a bookmark
> >     Filter the data set using the new date
> >     Cycle through any existing records and store certain
> >     information internally
> >     Turn off the filter
> >     Set the bookmark

> >Granted, this may not be the best solution (I'm open to any
> >suggestions), but it works fine...up to a point.

> >Trouble occurs at a very strange place.  Using TDBGrid, I can follow the
> >data and see which record I'm supposed to be on.  The field that I look
> >at that contains a date is called Deadline.  As long as there aren't too
> >many records in a row with the same value in Deadline, then all's fine.
> >But as soon as there are too many, then the Access Violation fairy
> >appears.  What I mean is this....If five records are visible in the
> >TDBGrid control, then for the most part, the cursor is on the record in
> >the middle -- or the third one -- as I press the Next button on the
> >TDBNavigator control.  However, when two records share the same value in
> >the Deadline field, then instead of moving all the records up and the
> >cursor indicator staying in the middle, it drops down one, so that it
> >now sits on the fourth visible record.  If there are only two in a row,
> >then it goes back to "normal" behavior after this, but, if there are
> >more with the same value, then the arrow moves to the fifth.  On
> >pressing the Next button when the arrow is on the fifth (or last if the
> >DBGrid size is different), then I receive an access violation.  I can
> >NOT figure this out.

  travis.vcf
< 1K Download

Re:Desperate for help...What am I missing?


You might preface the GotoBookmark (near the end of your sample code) with

if DataSource.DataSet.BookmarkValid (BkMrk)
then DataSource.DataSet.GotoBookmark (BkMrk);

Have you traced through the code to find the statement that is causing the
a/v?

Other Threads