Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Design question - should this be a child?
Message
General information
Forum:
Visual FoxPro
Category:
The Mere Mortals Framework
Miscellaneous
Thread ID:
00187538
Message ID:
00187611
Views:
25
>I am working on an application that is using the cbizmaintenanceform as the base for one of the screens. One the second page of the form, I have a group a fields used to fill our customers name/address information. My primary business object uses a table that stores all of this information (as well as a lot more)(estimateobj). I also have a business object that deals only with a “customers” table (customersobj). The idea behind this is that when they are entering the information they can click on a Find button to look up a previous customer (via customersobj). Since it is possible that the customers address may change, I also store this information through the estimateobj.
>
> Would the customersobj be considered a child object of the estimateobj? Before saving any customer information, I’d like my customersobj to check to make sure the customer name doesn’t already exist. If it does, set a flag to let my application know that a duplicate might exist (and to prompt the user to ask them what they’d like to do – add a new customer record or replace the existing customer’s info). I guess maybe the real question I’m asking is, what order is the Save() method of my parent/children objects called? Parent first, then children? Since the controls on the form will probably be bound to the primary view of estimateobj, at some point I need to pass this information to my customersobj so it can either save or flag it for my app to display a prompt. If I place my code in the PreSaveHook() of the estimateobj I would have to make the assumption that the primary Save() method is called first; if it isn’t, the my code in PreSaveHook would fail.
>
> The next question would be, at what point in my application should I check the flag put up by the customersobj? I guess by the time it reaches the PreSaveHook() it might be too late (since I don’t want to mix in form code in my business object).
>
> Any ideas on how I should approach this?
>
>Thanks,

Hi Paul,

If I understand you correctly, I don't see a need for some sort of parent/child relation. I see the customer table more as a lookup in your scenario. You might use a similar approach as the cifcombo: in the case you show existing records, the customer name is displayed in the combo. For a new record, let your users type in the name, and if it is not found, fire an addform. You might want to place a push button aside of the combo that would trigger a form to display detailed customer info, and allow for changes there.

José
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform