Subject Re: [IBO] I dont want to see the record by postretain
Author james_027
Hi
--- In IBObjects@yahoogroups.com, Helen Borrie <helebor@t...> wrote:
> At 07:00 PM 5/12/2003 +1100, you wrote:
> >At 04:00 PM 5/12/2003 +0800, you wrote:
> > >Good day.
> > >
> > >I have another problem. =( .
> >
> >Lots of problems here. This is NOT a good design.
> >
> >
> > >I have a mater detail setup in my application. I want to perform
a check
> > >first before saving the records to prevent duplicate entry of
invoices.
> >
> >Why?
> >
> >Begin by saying where you are getting the invoice number from.
>
> You replied that it is printed on the invoice. So - printed
invoices exist
> before they are entered into the database, yes?
>
>
> >I'm top-posting this so I can keep the rest of your description
together
> >with this.
>
> Top-posting is replying to a message by typing at the beginning and
leaving
> the rest of the original message intact. Usually it is "bad
netiquette" to
> do this, but, (as usual) it is difficult to get sufficient
information from
> you. Hence the choice to keep the little amount of information you
provided.
>
> > >So in the master dataset before post i have something like this
> > >
> > >if masterdataset.state = dssinsert and not
masterdataset.ispostretaining
> > >then
> > > // search for possible duplicate records code is here
>
> If you are using the invoice number as the primary key of the table
(a bad
> design choice) then you need to check for duplication *before* you
let the
> application try to insert anything. Write a CheckInvoiceNumber
method that
> queries the database to check this.
>
> Don't allow the user to enter the invoice number into the table:
provide a
> non-data-aware input field. Pick up the entered string and pass it
to your
> CheckInvoiceNumber method. Call CheckInvoiceNumber *before* you
allow the
> dataset to go into Insert mode. It can be a TIB_DSQL that executes
a SP
> and returns True or False as an output parameter. If it returns
True, you
> can tell the user that the invoice already exists and go no further.
If it
> returns False, it's OK, and you can pick up the Invoice number from
the
> TEdit in the BeforeInsert handler and assign it read-only to your
column.
>
> Helen

I didn't use the Invoice number as the primary key. Yes, the invoice
exist before entering it into database. Because this invoices aren't
company's invoice but they invoices from our purchases. Hope you
understand my english. I be glad if you find my design very wrong.

My question is there a way when searching for a duplicate record that
that it will not see the postretain done by IBO?

Thanks bearing with me.

James