Last active
December 22, 2015 13:59
-
-
Save seanbamforth/6483168 to your computer and use it in GitHub Desktop.
Visual Dataflex - Example of Parent Child Saving using Business Processes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Object oTestSave is a BusinessProcess | |
Object oVendor_DD is a Vendor_DataDictionary | |
End_Object | |
Object oInvt_DD is a Invt_DataDictionary | |
Set DDO_Server to oVendor_DD | |
End_Object | |
Object oCustomer_DD is a Customer_DataDictionary | |
Send DefineAllExtendedFields | |
End_Object // oCustomer_DD | |
Object oSalesp_DD is a Salesp_DataDictionary | |
Send DefineAllExtendedFields | |
End_Object // oSalesp_DD | |
Object oOrderhea_DD is a Orderhea_DataDictionary | |
Send DefineAllExtendedFields | |
Set DDO_Server to oCustomer_DD | |
Set DDO_Server to oSalesp_DD | |
End_Object // oOrderhea_DD | |
Object oOrderdtl_DD is a Orderdtl_DataDictionary | |
Set DDO_Server to oInvt_DD | |
Set Constrain_file to ORDERHEA.File_number | |
Set DDO_Server to oOrderhea_DD | |
End_Object | |
Procedure FindInvtItem String sCode | |
Clear Invt | |
Move sCode to Invt.Item_ID | |
Find eq Invt by Index.1 | |
Send Find_By_Recnum to oInvt_DD Invt.File_Number Invt.Recnum | |
End_Function | |
Procedure CreateOrderLine String sCode Integer iQty | |
Boolean isError | |
Boolean isAborted | |
Integer iRecnum | |
Begin_Transaction | |
Send Request_Clear to oOrderdtl_DD | |
Send FindInvtItem (sCode) | |
Set Field_Changed_Value of oOrderdtl_DD Field OrderDtl.Qty_Ordered to iQty | |
Get Request_Validate of oOrderdtl_DD to isError | |
If (not(isError)) Send Request_Save to oOrderdtl_DD | |
End_Transaction | |
Get_Attribute DF_TRANSACTION_ABORT to isAborted | |
Showln OrderDtl.Recnum ":" OrderDtl.ITEM_ID ":" isAborted | |
End_Procedure | |
Procedure CreateNewOrder | |
Boolean isError | |
Boolean isAborted | |
Begin_Transaction | |
Send Request_Clear to oOrderhea_DD | |
Send Find_By_Recnum to oCustomer_DD Customer.File_Number 23 | |
Send Find_By_Recnum to oSalesp_DD SalesP.File_Number 2 | |
Set Field_Changed_Value of oOrderhea_DD Field OrderHea.Terms to "COD" | |
Get Request_Validate of oOrderhea_DD to isError | |
If (not(isError)) Begin | |
Send Request_Save to oOrderhea_DD | |
Send CreateOrderLine "CASE" 2 | |
Send CreateOrderLine "GOLD" 5 | |
Send CreateOrderLine "XMENU" 7 | |
End | |
End_Transaction | |
Get_Attribute DF_TRANSACTION_ABORT to isAborted | |
Showln Orderhea.Recnum ":" isAborted | |
End_Procedure | |
End_Object |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment