Using Data Dictionaries in Business Processes: Difference between revisions

(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...)
 
 
(2 intermediate revisions by 2 users not shown)
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===
In the above example the Item_ID is not set to capslock. This is because the capslock is actually not part of the validation or save, it is a setting used by the dbForm and other visual objects. If we want to also apply these settings, we need to do some more.
In the above example the Item_ID is not set to capslock. This is because the capslock is actually not part of the validation or save, it is a setting used by the dbForm and other visual objects. If we want to also apply these settings, we need to do some more.
   Example required
   Example required, checking the following Data Dictionary field property, from the Request_Validate function.
  Set Field_Options field Customer.Id to DD_CapsLock
 
==Updating existing records==
==Updating existing records==


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

edits