Multi-Instance Fields Options

Updated on

All of the iMIS field types are equally available for both single-instance and multi-instance tables. A multi-instance table can have anywhere from 0 to an unlimited number of records for each iMIS user. Multi-instance records are usually used for data that is repetitive in nature such as work history, continuing education submissions, academic history, etc.

When adding a multi-instance record to a Sonic Form you must consider both the source and the target of the data.

Multi-instance Sources
  • New – a fresh (blank) multi-instance record is loaded with appropriate defaults (checkbox is empty, numeric fields are zero, text fields are blank, date fields are blank).
  • First – the first record in the multi-instance table – normally the oldest record on file, a new record is loaded if not found.
  • Last – the last record in the table – normally the most recent record on file, a new record is loaded if not found.
  • Parameter – a record matching a specific parameter value in the multi-instance table (e.g. YEAR=2013) for that user is loaded. If that value is not found, a new record is loaded.
Multi-instance Targets
  • New – a fresh (blank) multi-instance record is saved with the data captured on the form.
  • First – the first record in the multi-instance table is updated by the form.
  • Last – the last record in the multi-instance table is updated by the form.
  • Parameter – the record matching a specific parameter value (e.g. YEAR=2015) is updated by Sonic Forms.

Examples

  • A user must file an annual work history showing their employment each year. To save time, the form loads with their most recent record: LOAD=LAST, SAVE=NEW.
  • A user has four records on file, an IQA is used to display the records with an “Edit” link beside each one. The “Edit” link goes to a Sonic Form which displays and updates the record selected by the user. LOAD=WHERE, SAVE=WHERE.
  • In 2017 a user goes to add their annual work history to their existing record. The form loads their last year's employment history but when the form is saved it creates a new record for them. LOAD=YEAR="2016", SAVE=NEW.
Pro Tip: When using Multi-instance fields it is very important that all of the fields have the same Source and Target settings otherwise the form will not save properly and data may become corrupted or damaged.


 

Using the Where Option

The "Where" option for multi-instance records provides you with both control and flexibility in how you update your data. When a "Where" statement is added to a Form Part, Sonic Forms will evaluate the user's data to read and update the correct record. The dropdown list includes all of the fields available in the Multi-instance record. For example:
 
  • SEQN - the unique record number generated by iMIS
  • YEAR - a field showing a four-character year code
  • MENTOR - an iMIS ID for a person who is designated as a MENTOR
A Where statement can use any field in the Multi-instance table to help you identify the correct record. Where statements must always be unique and use the Equals operator.

Simple Where Statements

A simple Where statement uses a hard-coded value to specify a record. For example,

Where YEAR = '2015'

will return the first record found where the Year is equal to 2015.
 

Dynamic Where Statements

When creating a Where statement, you can also specify a URL parameter by using the coding of "@ff@" which signals to Sonic Forms to look for a URL parameter with the appropriate name. The most common use of this is to use the SEQN number from the multi-instance record itself ot specify a single unique record.

Where SEQN=@ff@SEQN

will return the record whose sequence number matches the sequence number included in the URL.