Examples of whats going on in the background when you import

In this topic we step through the process of importing a set of route records from an XML file. This lets you get an understaning whats going on in the background when you import data so that you get an understanding of the complexity of this process.

The code -
Local lo as "RP_CLIENT"
lo = Createobject("RP_CLIENT")
lo.SetConnection("LOCAL")
lo.SetSystem("W5102Z5D")
lo.OROUTE.importfromxml("C:\DATA\ROUTEUPDATE.XML","account == {account} and system == {system}",,'account')

Steps

Before looping through each XML record

For each XML record -
Copy XML record to a FoxPro Object
If a PK value is provided then load that record - *
If a match on expression is provided then loop through all fields in the XML record and substitute the value for the XML field name and then query the route table looking for a match - *
If not then create a new record - ***
If a default value RAMS record was provided then copy the deault values to this new record
Copy the the temporary foxpro object record to the Rams Business Object record and apply any formatting - RAMS and Promatrix
Apply any import custom hook formatting
Save the record

Creating a new record
Load a blank business object - *
Add default values to this as set byRAMS logic AND Promatrix Logix - ***

Saving a record
Create a new PK value following RAMS - *
Update the last modified field
Make sure access to the database is not blocked by administrator
If validate on save is on validate the record
If a prehook server is being used then pass off control to custom pre save actions
Append the record to the table
Commit transaction
Perform RAMS post save logic

Validate if Validate on Save is on
If record validate is on then validate all fields in the record with both Promatix AND RAMS logic - ***
If pre save logic then perform RAMS pre save logic.


Pre Save Logic
In the case of route records this means
Update Pickups in Routes table
Put a new record in the servlinks table or modify existing order if day number is different


Last Updated: 12/09/2006