Using Data Dictionaries in Business Processes: Difference between revisions

no edit summary
(New page: ==Why not direct file buffer access== In many cases, direct file buffer access would be simpler. But, it goes around your carefully constucted validation rules etc. Surely you can duplicat...)
 
No edit summary
Line 5: Line 5:
===Simple Example===
===Simple Example===
The simplest example is where we save new records in a table that does not have a parent file.  
The simplest example is where we save new records in a table that does not have a parent file.  
 
<pre>
   Function CreateCustomer String sName String sEmail
   Function CreateCustomer String sName String sEmail
       Handle hServer
       Handle hServer
Line 22: Line 22:
       Function_Return iError
       Function_Return iError
   End_Function
   End_Function
 
</pre>
This save takes all the Data Dictionary rules into account that are linked to the validation and save mechanisms. So is much better than direct file access (using clear, move and saverecord).<br>
This save takes all the Data Dictionary rules into account that are linked to the validation and save mechanisms. So is much better than direct file access (using clear, move and saverecord).<br>
But this simple example does not work if the record has a relationship to a parent table. It is also not using any field settings like capslock.
But this simple example does not work if the record has a relationship to a parent table. It is also not using any field settings like capslock.
Line 28: Line 28:
===Relationships===
===Relationships===
When the record you wish to create has a relationship to a parent record, you have to first find the parent record, just like you do in a view, prior to issueing the save. Lets create inventory for an existing vendors.
When the record you wish to create has a relationship to a parent record, you have to first find the parent record, just like you do in a view, prior to issueing the save. Lets create inventory for an existing vendors.
 
<pre>
   Function CreateInventoryItem Integer iVendor_ID String sItem_ID String sDescription
   Function CreateInventoryItem Integer iVendor_ID String sItem_ID String sDescription
       Boolean bNotOk
       Boolean bNotOk
Line 48: Line 48:
       Function_Return iError
       Function_Return iError
   End_Function
   End_Function
 
</pre>
This works nicely by finding the parent Vendor record, then create the new item.
This works nicely by finding the parent Vendor record, then create the new item.
===Field Settings===
===Field Settings===
Line 56: Line 56:


==Deleting records==
==Deleting records==
[[Category:Data Dictionaries]]
221

edits