Delete a file
Delete a file in a jig
In this example, a list of expenses is displayed with the following:
The
subtitledisplays thefilename.A
labelis configured withcolorand text to display the status of the file.A
left swipeableaction is configured with two actions:The first only deletes the file associated with the record using the
execute-entityaction with theupdatemethod and the file property set tonull.The second deletes the entire record in the database using the
execute-entityaction with thedeletemethod.

title: Expense Categories
description: List of Expenses
type: jig.list
icon: bill-cross-money-clipboard
header:
type: component.jig-header
options:
height: medium
children:
type: component.image
options:
source:
uri: https://cdn.pixabay.com/photo/2023/08/22/11/57/finance-8206242_1280.jpg
data: [email protected]
item:
type: component.list-item
options:
title: [email protected]
# Configure the subtitle to display the document filename.
subtitle: [email protected]
# Use the label to show the status of the file,
# as shown in the file metadata.
label:
color:
- when: [email protected] = 'UPLOADED'
color: color2
- when: [email protected] = 'PENDING'
color: primary
- when: [email protected] = 'PROCESSING'
color: color3
title: [email protected]
leftElement:
# Configure a left avatar int he list to display the file thumbnail.
element: avatar
text: ""
uri: |
[email protected] != null ? 'data:image/png;base64,' & @ctx.current.item.thumbnail :
@ctx.current.item.localPath != null ? @ctx.current.item.localPath
# Configure a left swipeable action with two actions,
# the first deletes the entire record in the database.
# The second only deletes the file associated with the record.
swipeable:
left:
- label: Delete expense
icon: delete-2
color: negative
onPress:
# First action deleting entire record.
type: action.execute-entity
options:
provider: DATA_PROVIDER_DYNAMIC
entity: default/expenses
method: delete
goBack: stay
data:
id: [email protected]
- label: Delete receipt
icon: bin-2-alternate
color: warning
onPress:
# Second action only deletes the file.
# The records still exists.
type: action.execute-entity
options:
provider: DATA_PROVIDER_DYNAMIC
entity: default/expenses
method: update
goBack: stay
data:
id: [email protected]
file: null
# Action configured to go to the create expense jig,
# where a file can be uploaded.
actions:
- children:
- type: action.go-to
options:
title: Create Expense
linkTo: files-create-expense datasources:
expenses-ds:
type: datasource.sqlite
options:
provider: DATA_PROVIDER_DYNAMIC
entities:
- default/expenses
query: |
SELECT
id,
'$.expenseitem',
json_extract(file, '$.localPath') as localPath,
json_extract(file, '$.fileName') as filename,
json_extract(file, '$.status') as status,
json_extract(file, '$.thumbnail.base64') as thumbnail
FROM [default/expenses]
ORDER BY '$.expenseitem'In Management the Hotel accommodation record is deleted in the expense dynamic data table and the airplane ticket file is deleted but the record still exists.
Delete a file in Jigx Management
Files can be deleted in Management by following these steps:
Log in to https://manage.jigx.com.
Browse to the required solution's data tab and select the record containing the file to be deleted.
Select the File tab, and click the x next to file's thumbnail. Caution: Clicking the Delete button at the bottom of the Edit record pane deletes the entire record and file.
Last updated
Was this helpful?