Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Stupid question
Message
De
27/01/2000 16:37:59
 
 
À
27/01/2000 16:27:56
Information générale
Forum:
Visual FoxPro
Catégorie:
The Mere Mortals Framework
Titre:
Divers
Thread ID:
00323794
Message ID:
00323809
Vues:
25
>>This might be a stupid question, but it wouldn't be the first time ;-) I've always assumed that whenever you called another business object that was going to add/edit/delete records you had to make it the primary business object first. Is this really the case?
>>
>> Here's an example of what I'm thinking about:
>>
>>User creates a new invoice, fills it in, then clicks on Save.
>>
>>In the PreSaveHook() of this business object, I check to see if this is a new invoice. If it is, I create a reference to another business object that returns the next available invoice number. So the code looks something like:
>>
>>
>>LOCAL loShopInfo
>>
>>* Create object, pass the ID of the location we're currently at
>>
>>loShopInfo = CreateObject("shopinfoobj",goApp.iShopIID)
>>
>>* Which business object should be primary?
>>* Business object responsible for v_invoice is currently primary
>>
>>REPLACE v_invoice.invoicenum WITH loShopInfo.GetNextInvoice()
>>
>>
>>
>>The GetNextInvoice() method of the loShopInfo object just grabs the current number, adds one, saves the new value and returns the new invoice #.
>
>Paul,
>
>The answer to your question is no. But in this case it would be best to use an event object to coordinate the two objects. Read the documentation on event objects.

Paul,

Why don't you simply let the framework generate your invoice numbers by making invoice number the key field and set the default value to newID()? That way you don't need to use two bizobjs.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform