Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Stupid question
Message
General information
Forum:
Visual FoxPro
Category:
The Mere Mortals Framework
Title:
Stupid question
Miscellaneous
Thread ID:
00323794
Message ID:
00323794
Views:
42
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

RCS Solutions, Inc.
Blog
Twitter
Next
Reply
Map
View

Click here to load this message in the networking platform