Status of a file

This example demonstrates how to track the upload status of a file and retry uploads for any that fail. The _fileStatus system table, along with the expense Dynamic Data table, are used as datasources to display upload progress.

Progress is shown in a list-item using color, progress, and a status label. If a file fails to upload, swipe left and use the action.retry-queue-command to attempt the upload again.

# Use this jig to upload a file. 
title: Expense Claim
description: Expense
type: jig.default

header:
  type: component.jig-header
  options:
    height: medium
    children:
      type: component.image
      options:
        source:
          uri: https://cdn.pixabay.com/photo/2016/05/04/23/02/receipts-1372960_1280.jpg

inputs:
  expenseId:
    type: string
    
onFocus:
  type: action.reset-state
  options:
    state: [email protected]
    
children:
  - type: component.form
    instanceId: expense
    options:
      isDiscardChangesAlertEnabled: false
      children:
        - type: component.field-row
          options:
            children:
              - type: component.text-field
                instanceId: expenseitem
                options:
                  label: Expense detail
              - type: component.number-field
                instanceId: expenseamount
                options:
                  label: Amount
                  format:
                    numberStyle: currency
                    currency: USD
        - type: component.text-field
          instanceId: fileName
          options:
            label: File name      
        - type: component.media-field
          instanceId: expenseimage
          options:
            label: Expense receipt
            mediaType: any
            maximumFileSize: =500 * 1024 * 1024
            isMultiple: false

actions:
  - children:
      - type: action.action-list
        options:
          title: Submit
          isSequential: true
          actions:
            - type: action.execute-entity
              options:
                provider: DATA_PROVIDER_DYNAMIC
                entity: default/expenses
                method: create
                data:
                  expenseitem: [email protected]
                  expenseamount: [email protected]
                file: 
                  localPath: [email protected]
                  fileName: [email protected]
            # The file upload progress is shown in a new jig, 
            # use go-to action to navigate to the jig.
            # Provide the inputs for the file.    
            - type: action.go-to
              options:
                linkTo: expense-file-upload-status
                inputs: 
                  expenseId: [email protected]
                  fileName: [email protected]

Last updated

Was this helpful?