What is Information Set?
The information set is a technique to work with a database table with a ready-to-use user interface.
In the real world, information is always preserved as a record and categorized in many ways. Computer systems commonly follow the below-phased method to manage entries, called crud data management.
- Create record
- Modify and update the record.
- View entry
- Delete entry
A few more techniques are required to process the data in the system, like
- Do data validation.
- Arrange the proper input fields.
- Apply data access control.
- Define the data types.
- Develop a user interface to manage data.
To defend the first line of support, Apprain provides the below two features:
- Information Set
- Category Set
Notes:
* Information Set: accept other information sets or category sets as input fields.
* Number of library functions available to fetch and manage data from both of them.
Information sets are created through XML files containing all necessary fields and basic information. Below are the methods to create an information set.
Method 1: Work in base framework
All the files are typically saved in the below location:
development/definition/information_set
Here are some important points to be followed:
- Each XML file in this folder is considered a database table and is loaded automatically by the system.
- The name of the XML file considered the table name.
- The file name must follow the convention of the database table name.
- A separate file name can be assigned when a callback function is used in a component.
There are two steps to creating any information set:
Step 1: Create the XML file
The XML has two main parts which are enclosed by the tag
The base part contains all the basic information in the information set. Here is an example.
At this stage, two fields are very important. The first is <title>, which carries the name of the information set, and the second is
After completing the base part the Interface Builder request the database fields name in the tag of fields. Here is an example:
Field/Attribute | Description | Example |
---|---|---|
Name | Define as tag attribute | <field name="message"> |
Title | Title of the fiend display in the interface | <title>Message</title> |
Type | HTML input type | <type>textareaTag</type> |
Validation type | Type of the data validation in <rule> | <type>notEmpty</type> |
Error Message | Display message if failed | <err-message>Please enter value</err-message> |
Parameters | Additional attribute | <parameter name="richtexteditor">Yes</parameter> |
DB-attribute | Database filed attributes |
<attribute name="type">text</attribute> <attribute name="length"></attribute> <attribute name="null"></attribute> <attribute name="default"></attribute> |
Tag-attributes | HTML Tag attributes |
<attribute name="id">description</attribute> <attribute name="class">app_input</attribute> <attribute name="rows">20</attribute> |
Click here to check out more details on field specifications. Below are the common fields for an information set:
InputTag | TextareaTag | FileTag |
SelectTag | RadioTag | CheckboxTag |
dateTag | InformationSetTag | CategorySetTag |
Two major tasks here are to create the XML file and arrange all the necessary fields as needed. A complete file is given below, for example.
Step 2: Add the access links in the Interface Builder to create and manage data
Once the information set in XML is ready, it needs to be accessed from the interface to perform the crud operation. Below are the access links for an information set.
Type | Convention | Example |
---|---|---|
Add Entry | /information/manage/[name]/add | /information/manage/blogpost/add |
Manage Entries | /information/manage/[name] | /information/manage/blogpost |
* [name] is the information set name; generally, it is the name of the XML file. More about the access link here.
Finally, this access link is used to add the Interface Builder in the admin panel to create interface; see the below example.
Method 2: Work Component
This is a continuation of Method 1. Components always keep resources isolated, so the XML file should be placed inside the working component directory. See the path below:
component/[component name]/information_set
For example, if the component name is “appbog” and the information set name is "blogpost", then create the file in the below location:
component/appblog/information_set/blogpost.xml
After file creation is done, the information set file needs to be registered in the component through the below callback method.
In init() method
Method body considering above example
Function Reference
InformationSet gives facilities to manage data; however, it is always expected that Framework can access data and use it. Below are the methods that help to work with information set through programming.
Find | FindByField | findAll |
findAllByField | Paging | idToName |
oneDArray | countEntry | Save |
Delete | DeleteByField | Tag |
Summary
As a CMS tool it helps to manage data in database tables through an auto-generated interface. Let's recap.
- First, create the XML file with all the required fields.
- Second, if it’s a component, create the file inside the component directory; otherwise, in the development area.
- Finally, set the menu in the admin panel to access the user interface and manage data.
Important: An information set acts like a database model, so use the list of functions to manage data inside your code and save time.