Binding data to packages
Glossary Item Box
Introduction
It is often necessary to provide certain data together with newly developed functions when delivering custom packages. The data might include lookup values, new system settings, demo section records, etc.
Use the [Data] tab of the [Configuration] section to bind needed data to a package containing the developed function. You can find general information about the tab including recommendations and common data binding mistakes in the "The [Configuration] section. The [Data] tab” article.
Case description
Binding two demo records and their linked records from other sections for the [Books] custom section.
ATTENTION
When adding a section, the data necessary for registration and correct section operation are linked to the package via wizard (Fig.1).
Fig. 1. Data collection linked to the package via wizard
Source code
You can download the package with case implementation using the following link.
Case implementation algorithm
1. Adding a new [Books] section
ATTENTION
Create a new section function in a separate developer package. Select the developer package in the [Default value] column of the [Current package] system setting to create schemas in the developer package via section wizard. After wizard operation is over, you can set up Custom package as your current package.
Use the section wizard to add a new [Books] section. Section properties and field location on record edit page are shown on fig. 2 and fig. 3.
Fig. 2. The [Books] section properties
Fig. 3. Record edit page properties
The base properties of edit page columns are specified in table 1.
Table 1. Edit page column properties of section records
Title | Name (Code in DB) | Data type |
---|---|---|
Name | UsrName | String |
Description | UsrDescription | String Multiline text |
ISBN | UsrISBN | String |
Author | UsrAuthor | The [Contact] lookup. The column value will be bound to one of the [Contacts] section records. |
Publisher | UsrPublisher | The [Account] lookup. The column value will be bound to one of the [Accounts] section records. |
Price | UsrPrice | Decimal |
2. Adding needed records to the section
Add two demo records to the section (Fig.4). Add records to the bound [Contacts] and [Accounts] sections if needed.
Fig. 4. Section records
3. Binding contact data to the package
Since the [Books] section records are bound to the [Contacts] section records by the UsrAuthor column, bind the author data to the package first. Run the [Add] command on the [Data] tab of the [Configuration] section and set up the following properties of the page for binding data to package (Fig/5):
1. [Name] – “ContactsInBooks”
2. [Object] – “Contact”
3. [Installation type] – “Installation”. Possible installation types are described in the "The [Configuration] section. The [Data] tab" article.
4. [Columns] – select only the populated columns. It is required to select the [Id] column.
5. Data filtering – filter the needed data, for example, by contact name.
Fig. 5. Page for binding contact data to package
NOTE
Filtering by the Id column is recommended (see the following step), since the full contact name can be changed.
4. Binding account data to the package
Run the [Add] command on the [Data] tab of the [Configuration] section and set up the following properties of the page for binding data to package (Fig/6):
1. [Name] – “AccountsInBooks”
2. [Object] – “Account”
3. [Installation type] – “Installation”
4. [Columns] – select only the populated columns. It is required to select the [Id] column.
5. Data filtering – filter the needed data, for example, by account identifier. You can determine the identifier from the browser address bar by opening the needed record edit page (Fig. 7)
Fig. 6. Page for binding account data to package
Fig. 7. Determining the account identifier
5. Binding custom package data to the package
Run the [Add] command on the [Data] tab of the [Configuration] section and set up the following properties of the page for binding data to package (Fig/8):
1. [Name] – “Books”
2. [Object] – “Books”
3. [Installation type] – “Installation”
4. [Columns] – select only the populated columns. It is required to select the [Id] column.
5. Data filtering – filter the needed data. If a section contains only two records you can avoid using the filter (Fig.8).
Fig. 8. The page of binding custom section data
As a result of case implementation, three additional data collections for three sections will be bound to the package (Fig.9).
Fig. 9. The [Data] tab of the developer package
You can export packages to archive using the corresponding function (see “Exporting packages from the application interface”). After you install the package into another application, the bound records will be displayed in the corresponding sections.