Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Handling 1:M:M with views
Message
De
05/02/1999 10:14:15
 
 
À
04/02/1999 17:50:26
Kenneth Downs
Secure Data Software, Inc.
New York, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00184085
Message ID:
00184355
Vues:
23
>The problem, which I might not have expressed precisely, is what to do when the user has not yet saved the top-level parent. With a new, unsaved, parent, a new, unsaved, child, and new, unsaved grandchildren. When the user attempts to add a new child record, you must force the user to save at that point or the grandchild records to the first child are either lost or saved as orphans.
>

Not true... you'll have to do a little coding here to check what's going on. But, if you are adding to a view, don't requery it's child... or, you can use a seperate view to add the grandchild records.

What I would say is a better idea is to force the save of the parent before adding a child. This would flow down your repleation ships. (this would also not require pre-fetching ID's) For example, lets say your three relation ships are...

Customer -> Invoices -> Line Items...

You have a screen that shows all those items. So, the user ADDS a customer... ok, all well and good... now the customer clicks onto the invoice page and clicks add. You'r code would look to see if the status of the current customer was IsNew or such, (recno < 0). You put up a message that would say...

You MUST Save the customers record prior to creating an INVOICE for him.

Makes sense to me, and perhaps your user. How can I add an invoice to a customer that doesn't exist yet? Sure, I pressed NEW and typed in his info, but he hasn't been saved. Also, what if your Customer BizRules don't fire until a record was saved. The customer record could be in violation of a biz rule... perhaps he is in a catagory which doesn't exist for his state? (I know some people check biz rules prior to save)

Ok, so now you add an invoice and the user goes to add line items... Here you could save the invoice first, before adding line items too. (don't have to) of course.

But, I would not allow them to add a second invoice until the first was saved, with its line items.

In all the above cases you could always delete the higher up record... so what if it was commited to the tables?

So, ask yourself... is one of these relation ships seperate from the entity the files define. For example a Customer stands alone whereas the invoice needs two files.

Anyway... I guess the answer is there is no one answer. However, you CAN code it to act the way you want. As someone said, if you are switching to your GrandChild view, and the parent is a new record, don't requery, just set a filter on the view. This should work to and give you what you want also.

Good luck!
BOb
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform