Skip to content

Read a complete application

This complete .mtd file shows the main declarations together. It gives finance staff access to every claim. For ownership and department rules, read Control who sees what.

app claims "Claims" {
mount: /
locale: en
roles { finance "Finance" }
auth { methods: [password] }
nav main "Claims" { claims }
}
right manage_claims "Manage claims" {
finance
}
table claims "Claims" {
display: description
description text required "Description"
claimed_on date required "Date" { default: today }
amount money required "Amount" { min: 1 }
lifecycle status "Status" {
state draft default "Draft"
state approved "Approved"
transition approve draft -> approved "Approve" {
access: finance
}
}
}
page claims "Claims" {
route: /
access: manage_claims
report of claims {
columns: description, claimed_on, amount, status
export: csv, xlsx
button "New claim" -> claim
row -> claim
}
}
page claim "Claim" {
route: /claims/{id}
new_route: new
access: manage_claims
form of claims {
fields: description, claimed_on, amount
actions: save
after_save: claims
}
}

The engine supplies ids, audit columns, sign-in, validation, and CSRF protection. money stores cents; its input accepts 12.50 in English. The lifecycle supplies the status column and the Approve button. The form creates at /claims/new and edits at /claims/42.

Save the file in an application directory, then run matterdata validate <directory>. To create its tenant and finance login, follow Build your first app with -role finance.

Website privacy policy