Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Problems with kBizObjs
Message
General information
Forum:
Visual FoxPro
Category:
The Mere Mortals Framework
Title:
Problems with kBizObjs
Miscellaneous
Thread ID:
00120418
Message ID:
00120418
Views:
52
Hi,

Forgive me for my English and the size of the message, but I´ll try to explain my problem, as better as I can (I´m desperated).
I have a scenario, where one "Client" can have 1 or more than 1 "Address". Each "Address" can have 1 or more than 1 "Attention" (each "Attention" can be related to a certain product, procedure, department, etc...). Each "Attention" can have 0, 1 or more than 1 "Fax". There is a special "Attention" (the main "Attention" of an "Address") that has 1 "Fax" (they may be in blank, but they must exist). So I have the following tables :

Client :
id_client
...


Address :
id_address
id_client
...

Attention :
id_attention
id_address
ll_main
...

Fax :
id_fax
id_attention
...

In the first page (grid page) of the "Client" form (kBizObjMaintenanceform) I have the main BizObj based on a View that joins "Client" table with "Address" table (v_Client). In the second page (detail page) I have another BizObjs :
1) One for the "main attention of an address" (v_Attention_Main) that is based on a Parameterized View (the parameter is v_Client.id_address) whose ParentBizObj is v_Client and ll_main = .T. (nRequeryType = 1).
2) One for the "fax of the main attention of an address" (v_Attention_Main_Fax) that is based on a Parameterized View (the parameter is v_Attention_Main.id_attention) whose ParentBizObj is v_Attention_Main (nRequeryType = 1).

So when I add a record to v_Client View I need to add a record to v_Attention_Main View and a record to v_Attention_Main_Fax. So, in the OnNew() method of ClientBizObj I put :
...AttentionMainBizObj.New()

REPLACE id_address WITH v_Client.id_address IN v_Attention_Main

...AttentionMainFaxBizObj.New()

REPLACE id_attention WITH v_Attention_Main.id_attention IN v_Attention_Main_Fax

The problem is that when the Refresh() method of the second page is executed both AttentionMainBizObj and AttentionMainFaxBizObj are requeried and when AttentionMainFaxBizObj is requeried VFP is trying to insert this new record (Insert trigger is triggered) and the insertion fails since the "Attention" table is not updated yet.
What am I doing wrong ?

Best Regards and again thanks for your attention,
José Augusto Cavalcanti
Global Connection
jose.cavalcanti@globalconnection.com.br
Next
Reply
Map
View

Click here to load this message in the networking platform