Training Day

Data Synchronization

Keeping data consistent across multiple systems

Overview

Data synchronization maintains consistency between data stored in different systems. Key concepts include:

  • Direction: Uni-directional or bi-directional data flow
  • Consistency models: Approaches to change propagation
  • Conflict resolution: Handling conflicting changes
  • Data mapping: Translating between data structures
  • Change detection: Identifying modified data

When to Use

Ideal for scenarios where:

  • Related data exists in multiple systems requiring independent operation
  • Information needs availability in specialized systems
  • Different systems have separate ownership or administration
  • Offline capabilities are required

Synchronization Approaches

Full Synchronization

Complete refresh of all data:

  • Replaces all target data with source data
  • Resource intensive but guarantees consistency
  • Used for initial sync or periodic resets

Incremental Synchronization

Synchronizes only changed data:

  • Minimizes data transfer and processing time
  • Requires change tracking mechanisms
  • Can run more frequently due to lower overhead

Change-Based Synchronization

Event-driven updates:

  • Triggered by specific data changes
  • Provides near real-time updates
  • Focuses only on affected records
  • Requires robust change detection

Bi-Directional Challenges

Conflict Detection

Methods for identifying concurrent modifications:

  • Timestamp comparison
  • Version counters
  • Hash comparison
  • Field-level detection

Conflict Resolution

Strategies when conflicts occur:

  • Last writer wins
  • System priority-based
  • Field-level merging
  • Manual resolution
  • Custom business rules

FileMaker Implementation

Change Tracking

# Change tracking table structure
Create Table [Name: "ChangeLog";
  Fields: "record_id", "table_name", "field_name",
  "old_value", "new_value", "changed_by", "timestamp"]

# Simplified trigger to log changes
If [Get(RecordModificationCount) > 0]
  # Compare and log differences between old/new values
End If

External ID Management

# Mapping table structure
Create Table [Name: "ExternalSystemMap";
  Fields: "local_id", "external_system", "external_id", "last_synced"]

# Lookup example
Set Variable [$externalId; Value: ExecuteSQL(
  "SELECT external_id FROM ExternalSystemMap
   WHERE local_id = ? AND external_system = ?";
  ""; ""; $localId; "salesforce")]

Sync Status Dashboard

Key elements:

  • Last successful sync time
  • Pending records count
  • Conflict indicators
  • Sync history and errors
  • Manual sync controls

Common Scenarios

CRM Integration

  • Contact information (names, emails, phone)
  • Interaction history (communications, support)
  • Sales data (opportunities, deals, orders)

E-commerce Integration

  • Product catalog (items, pricing, descriptions)
  • Inventory levels across channels
  • Order processing status

Financial System Integration

  • Customer accounts and balances
  • Transaction records
  • Accounting entries

Advantages and Challenges

AdvantagesChallenges
Data available where neededComplex conflict resolution
Independent system operationNetwork reliability dependencies
Specialized system utilizationPerformance with large datasets
Offline capabilitiesSchema differences
Improved user experienceMaintaining referential integrity

Best Practices

  1. Establish clear ownership for each data type
  2. Implement robust change tracking mechanisms
  3. Use unique identifiers across systems
  4. Balance sync frequency with system load
  5. Handle errors gracefully with recovery paths
  6. Maintain detailed audit logs of all sync activities
  7. Design for recovery after failures
  8. Test edge cases including concurrent changes and conflicts