Deep Copy Action

This example demonstrates a sophisticated data operation that performs deep copying of complex hierarchical data structures across multiple related tables.

Key Features

  • Complex data relationships handling across multiple tables

  • Deep copying of parent-child hierarchies with file attachments

  • S3 file duplication with new URLs and expiration management

  • Progress feedback with loading states and navigation

  • Metadata-driven operations using dynamic table discovery

  • Transaction-like operations with comprehensive error handling

  • Screen navigation integration for user workflow

Use Cases

Perfect for applications requiring:

  • Course or template duplication systems

  • Project cloning with all associated data

  • Data migration and backup operations

  • Multi-tenant data copying

  • Template instantiation workflows

  • Complex data replication scenarios

Implementation Overview

This widget demonstrates the Advanced Data Operations pattern, performing complex operations across multiple related tables:

  • CourseTemplate → UserCourse (with questionnaires and questions)

  • File attachment copying with S3 operations

  • Hierarchical data relationships (1:M and N:M)

  • Dynamic metadata resolution for flexible table structures

  • Progress tracking and user feedback

Code Example

Key Concepts

Complex Data Relationships

  • Hierarchical Copying: Handles parent-child relationships across multiple levels

  • Template to Instance: Converts template data into user-specific instances

  • Relationship Preservation: Maintains data relationships during copying operations

  • Metadata-Driven: Uses dynamic metadata to discover table structures

Advanced S3 Operations

  • File Duplication: Copies files to new S3 locations with unique keys

  • URL Management: Generates new presigned URLs with proper expiration

  • Random Key Generation: Creates unique file keys to prevent conflicts

  • Error Handling: Graceful handling of S3 operation failures

Transaction-Like Operations

  • Multi-Table Operations: Coordinates operations across multiple related tables

  • Error Recovery: Comprehensive error handling with rollback capabilities

  • Progress Tracking: User feedback during long-running operations

  • Atomic Operations: Ensures data consistency during complex operations

User Experience Features

  • Loading States: Clear visual feedback during processing

  • Navigation Integration: Seamless screen transitions for user workflow

  • Progress Indication: Spinner animation during operations

  • Error Messaging: User-friendly error reporting

This deep copy example demonstrates how code widgets can perform sophisticated data operations that would be difficult or impossible with standard form fields, making it perfect for complex business workflows and data management scenarios.

Last updated