Re: In-Memory Dataset
- From: "Michelle Brennan" <mibi222@xxxxxxxxxxx>
- Date: 26 Oct 2005 20:01:03 -0700
Thanks for the links you provided. They were very informative,
but, from what I understood, they still don't solve one of
my major problems.
Problem occurs during INSERTs only, for example, when the user
clicks on Create New Invoice.
Here's the tipical procedure:
- User clicks Create New Invoice
- Invoice master key is temporarily set to -1 (why? see later
on)
- User inserts data for new detail item
- Detail foreign key is temporarily set to -1 (same as master
key)
- User clicks post for DETAIL item
- Detail item ***disappears***!!
Even though detail's foreign key is set to the same value as
master key, after the post of the detail dataset, the link
gets broken! From what I understood, for the link not to be
broken, I have to post master dataset BEFORE posting detail
dataset. This changes the master's state to dsBrowse, but this
messes up my logic because I need to have the Invoice in
INSERT state while new detail items are still being entered.
The state should only change to dsBrowse after the user clicks
on save invoice button, which should UpdateBatch everything at
once, including a newly generated key value (Invoice Number)
to replace the -1 temporary key values. This way, by
retrieving this new key value at the very last moment, right
before UpdateBatch, the number will not get wasted in case the
user aborts the Invoice and so, the key won't SKIP!!!
So I guess the main problem is: how to maintain master-detail
link during Inserts while not having to post master dataset
before posting detail dataset.
I have no problem inserting new detail items after the Invoice
has already been posted and UpdateBatched, so the problem here
is only for NEW Invoices.
By the way I tried detail's dataset with both masterfield and
parameter link to master dataset. Almost same results.
I hope I made myself clear and sorry for the long post.
I'd greatly appreciate your help!
"Kevin Frevert" <kevin@xxxxxxxxxxxxxxxxxxxxxxxx> wrote:
>Michelle,
>
> Take a look at using TClientDataSet in a 2-tier model..
>
>http://community.borland.com/article/0,1410,22571,00.html
>and
>http://community.borland.com/article/0,1410,20847,00.html
>
>..and don't fetch the next available number until you are ready to apply the
>insert (the BeforeUpdateRecord event in the TDataSetProvider).
>
>Good luck,
>krf
>
>"Michelle Brennan" <mibi222@xxxxxxxxxxx> wrote in message
>news:435ef28d$1@xxxxxxxxxxxxxxxxxxxxxxxxx
>>
>> I think I figured out a way to do BatchOptimistic Master-Detail
>> Inserts with sequential non-skipping ID numbers (for Order /
>> Invoice application). It's a work-around but I think it will
>> work.
>
>
.
- Follow-Ups:
- Re: In-Memory Dataset
- From: Kevin Frevert
- Re: In-Memory Dataset
- References:
- In-Memory Dataset
- From: Michelle Brennan
- Re: In-Memory Dataset
- From: Kevin Frevert
- In-Memory Dataset
- Prev by Date: Re: In-Memory Dataset
- Next by Date: Re: In-Memory Dataset
- Previous by thread: Re: In-Memory Dataset
- Next by thread: Re: In-Memory Dataset
- Index(es):