Setting up field definitions

Field definitions provide a way to expose low level information about the main entities in the Ticketmatic applications. This allows setup experts and regular users to configure views, ticket layouts and documents without technical knowledge of the public data model:

  • views are simply composed by selecting a set of field definitions
  • in ticket layouts all field definitions related to the ticket and order are available
  • in documents all field definitions related to the order are available

Field definitions always belong to one of the main entities in Ticketmatic:

* order * contact * event * ticket * payment

Field definitions are managed in the Field definitions module in the Settings app. Click the button below to go there:

Go to field definitions

Basic example

Let’s try a basic example. Press Add in the Contact tab to create a new field definition

image

Enter this configuration:

  • Name: the visible name for the field, use ‘First name’
  • Key: the key to reference the field in ticket layouts or documents, use ‘firstname’
  • Display: select how the field should be displayed. Use ‘String’
  • Width: default width of this field in views, use 40
  • Variable width: whether the field should be resized in views when necessary, check it.
  • Alignment: the field alignment

The definition field should contain the actual sql-clause.

For example, to display the first name of the contact:

1contact.firstname

The preview result section will display a few sample results in real-time.

Save the field definition. This definition is now ready to be used in views, ticket layouts and documents.


Definition

You use the public data model to define field definitions. A field definition is actually an sql select clause. Depending on the entity the field definition belongs to, the main sql table will be different. For example, for field definitions of type contact, the main table is tm.contact.

You can use any supported sql function in the definition. For example, to put the first name in upper case:

1UPPER(contact.firstname)

You can use subqueries as well. For example to create a field definition for the number of orders for a contact:

1(select count(*) from tm.order where tm.order.contactid=contact.id) as nbroforders

Joins

Depending on the field definition type, certain joins can be activated. For example, if you want to create a field definition for the address for a contact, you can use following definition:

1<NEEDED TAG="address"/>contactaddress.city

Bij specifying the NEEDED tag, you activate the join. Below is the list of joins that can be activated:

Contact

JoinTable that becomes available
addresstm.contactaddress
phone1tm.contactphonenumber
phone2tm.contactphonenumber
phone3tm.contactphonenumber
customertitletm.contacttitle

Order

JoinTable that becomes available
saleschanneltm.saleschannel
customertm.contact, tm.contactaddress and tm.contactphonenumber
paymentscenariotm.paymentscenario
deliveryscenariotm.deliveryscenario

Event

No optional joins are available, but eventlocation and production are always available automatically

Ticket

JoinTable that becomes available
baskettm.order
eventtm.tickettype and tm.event
pricetypetm.tickettypeprice and tm.pricetype
buyertm.contact (as buyer)
ticketholdertm.contact (as ticketholder)
seattm.seatrank
deliverystatusdeliverystatus
deliveryscenariotm.deliveryscenario
locktypetm.locktype

Payment

JoinTable that becomes available
baskettm.order
paymentmethodtm.paymentmethod
usertm.user

For more examples, take a look at the field definitions that by default are available in your account.


Questions?

We're always happy to help! Send us an e-mail