Defining Attributes (or "Fields")

Once you have added the required entities, you now need to add the attributes or fields for those entities.

The home page in the app will also prompt you to add the attributes, as shown below.


You can directly click on the Add an Attribute link in step 4 (or you can click on Attributes link under Admin to see a list of attributes which at this point will be empty and click on the Add Attribute button in that list view page) to proceed to add the attributes.

The initial Add Attribute Form will be like given below.



Details of options available in Add Attribute Form


Entity : The entity to which this attribute will belong to. Drop-down with all available custom entities (attributes cannot be added to system entities, like say for User).

Data Type : The data-type of the field. Drop-down field with all available types to choose from.

The different field data-types are listed below :

Adding attributes for each data-type are explained with examples further on in this guide.

Display Name : The name for this field, which will be used in the forms and views. Supports unicode and special characters.

Description : Useful hint for users who fill in the forms for this field.

Property Index : Similar to the Entity Index in the Entity configuration, determines the position of this field in relation to other fields.

Example : Field-A with property index of 5, Field-B with property index 10 will have Field-A listed before Field-B in forms and views. If at a later date you want to add a new field Field-A2 in-between Field-A and Field-B, you can add it with property index of 7.  You are encouraged to leave out slots to enable such field insertions at a later date.

Requires Value : If checked, the field will be marked as a mandatory field which always requires to have a value.

Data-type specific configuration options are detailed along with their example usage further down this page.

Other Attributes :


Hide in List : Specifies if this field be hidden in the list view by default. Explicit visible properties selected for custom views will over-ride this default option.

Hide in Details View : Specifies if this field be hidden in the details view.

Hide in Custom View : Specifies if this field needs to be hidden in the Custom View form, even if it is capable of being filtered.

Attribute Group Name : The sub-group of this field. All attributes coming under the same group will be listed under a section with a header having this group name.


Adding attributes for Owner entity.


For Owner entity, we will add the fields Name, Phone, Email ID, Mode for Payment, Address, Address On Map and Notes.

Adding a Single-line Text Field (for Owner's Name)


First up, Name will be a Single line text (String) field, which should always have a value for each record (check the Requires Value check-box). The name will also need to be indexed for easier searching, so the String Indexing option needs to be checked. The filled in form is shown below.


Configuration options available for String attributes


Choice Values : Choice Values can  be provided for Single line text (String) and List (with String values) attributes. The values need to be provided as comma-separated. When used with Single line text (String) attributes, this makes the field a drop-down selection box with the given values.

For example, providing the value as Choice 1, Choice 2, Choice 3 will result in select boxes as shown below..
Required field : (If the Requires Value is checked)
Optional field : (If the Requires Value is *not* checked)
For details on how choice values can be used in list with string attributes, kindly refer to Adding Multi-select list fields.

Is Email : Specifies if this field is an email field. For more details on the effects of marking the field as email field, see Adding an Email field.

Other Rendering : To render the text value as Phone, Web-link or a Skype number, choose the appropriate option.

Box Size : Specifies the size of the text field.

Unique : Specifies if the value of this field should be unique for each record entry.

Transform : Specifies the transformation that needs to be done to user input, before the value is saved into the record. The available options are detailed below.

trim :: leading or trailing empty spaces, if any, will be trimmed.
ltrim : (left trim) :: if there are additional spaces in the left, they will be removed.
rtrim : (right trim) :: if there are additional spaces in the right, they will be removed.
capitalize :: Capitalize the words. Example : some entry to Some entry
lower :: Convert to lower case. Example : Some Entry to some entry
upper :: Convert to upper case. Example : Some Entry to SOME ENTRY
title :: Convert to title case. Example : some entry to Some Entry
swapcase :: Swap the cases. Example : Some Entry to sOME eNTRY

String Indexing : Specifies if the field's first character be indexed. An index will also appear in all list views of the entity of this attribute.

The Description value will be shown next to the field in the forms. Click on Save & Add Next.

Adding a Phone field


Our next attribute will be the Phone number of the owner which will be a required field (Requires Value : Yes) having the Data Type as Single line text (String), as shown below.


For the Phone field we have made the Property Index value to be 5 so that it is listed after the Name field, while also allowing fields to be added in-between them at a later stage. That is, one can - at a later date - add a new attribute with Property Index as 3, so that the new attribute is shown between Name and Phone fields.

Also notice that the Other Rendering option has been set to Phone. this will add a tel: link to be added to the phone number.

Adding an Email field


Next, we will add an Email field in the Owner entity. We will have the display name for this field to be Email ID, data type as Single line text (String), Property Index as 10 so that it is listed after Name and Phone fields and with the Is Email value checked, as shown below. 

Checking the Is Email option have the following effect :
  • The field will be shown with a mailto: link, which when clicked will open the default email client. You can configure modern browsers to be your Gmail web-client too.
  • There will be a Send Mail button added to list views. You can select one or more records of this entity type and then send a bulk email using mail-merge like email template (this feature is in preview release).
  • There will be an option to import/upload data directly from/to Google Contacts. For this you will have to add the field mapping to map the attributes in your entity to the attributes in Google Contact entry.
The filled in form for the Email ID field in Owner entity, ready to be saved is shown below.


Click on Save & Add Next to proceed to the add next attribute.

Adding a Selection-box (choices / pick-list) field


To add a drop-down selection box field, the values for the selection needs to be provided in the Choice Values configuration. For more details refer to the Choice Values configuration details in Configuration options available for String attributes.


Adding a Multi-line text field (for Owner's Address)


To store the Address of the Owner, we will add a new attribute with Data Type as  Multi line text (Text) and with Property Index as 15 as shown below.


Click on Save & Add Next to proceed to the add next attribute.

Adding a Multi-select List field (for Mode of Payment)


Owners would like to receive payments collected from their tenants in the preferred mode of payment. We will store this preference as a list of values, which will be sub-set of all available payment modes. For this requirement we will add a field with Data Type as List (with String values) having Display Name as Mode of Payment and with Choice Values as Cash, Cheque, Demand Draft and Account Transfer. as shown below.


Click on Save.

Now that we have the basic attributes for the entity, we can proceed to see how we can work with this entity's records.

New Attributes as seen in Views and Forms


The default list views of Owner entity will now show all the attributes we just added, as shown in the image below. It will also have the Send Email button as we have an email attribute (having Is Email checked). You will also find the a button below the table suggesting that a field mapping be added to enable importing records form Google Contacts.



Also notice that there are a set of links to filter out records based on an alphabetical index of Name field, above the table.

Clicking on the Add Owner button in this view will bring up a form as shown below.


We will add a sample Owner entry to see how things work. Our sample entry details as entered in the form before saving the record to the database is shown below, with Name as Smith, John (so this should be indexed under 'S'), along with sample values for Phone, Email ID and Address fields. For the Mode of Payment we will mark the preference that Mr.John Smith can take in all modes except cash payments. We can also add additional Notes about this Owner. The Notes, Created On and Updated On fields are by default enabled for all entities, unless it was marked to be hidden in the entity configuration.



Clicking on Save will bring up the Details View, showing the sample record values as shown below. You can attach files from Google Docs to this database records or discuss about the record too, from this view. You will also find options to edit the record, copy the values to another new record and view the audit trails (available for admin users).



Clicking on the Owners link on the left navigation to go back to the list views, we can see our sample entry listed in the table.


Selecting an entry (clicking on the non-link sections of the row) will show the quick details below the table.



Adding Web-link field


To add a web-link field, choose the Data Type as Single line text (String) and with Other Rendering option (under String Attribute Details) as Web-link. This will add a clickable link with the value of the field.


Adding Yes/No check-box (Boolean) field


When you want to store just a Yes/No value, you can use set the Data Type of the attribute as Yes / No checkbox (Boolean) and. This will just show a simple check-box, which when left unchecked will be set to No


Adding Lookup (Reference) field


Look-up attributes can be used to define relationships between record types. The entity which is being referenced is called the parent-entity in a relationship while the entity which is referencing the parent is called the child-entity. You can add an attribute with Data Type as Lookup field (Reference) in the child-entity with the Refers To (under Reference Attribute Details) value as the parent entity. 

Note when using Reference fields:
  1. The parent-entity should have an Entity Index value less than that of Entity Index value in child-entity and there-by listed before the child-entity. 
  2. There cannot be cyclic-references, neither direct (A refers-to B, B refers-to A) nor in-direct (A refers-to B, B refers-to C, C refers-to A).
You can also use the Reference Indexing option to have a First character (English) based indexing, and similar to the String Indexing available for String attributes, an alphabetical-index will appear in all list views of the entity of this attribute which one can click to filter records based on the starting character.

Examples :

Owners, Properties & Tenants : 
  • Owner (parent-entity) has one-or-more Properties (child-entity). --> Property entity will have a look-up attribute with Refers To as Owner.
  • Tenants (child-entity) can live in a specific Property (parent-entity) --> Tenant entity will have a look-up attribute with Refers To as Property.
Also make sure that Entity Index of Owner  < Entity Index of Property < Entity Index of Tenant.

Customers, Contacts & Support Tickets :
  • Customer (parent-entity) has one-or-more Contacts (child-entity). --> Contact entity will have a look-up attribute with Refers To as Customer.
  • Customers (parent-entity) can have one or more Support Tickets (child-entity). These Support Tickets (child-entity) may have been raised by specific Contacts (parent-entity). --> Support Ticket will have 2 look-up attributes, one with Refers To as Customer and another with Refers To as Contact.
Also make sure that Entity Index of Customer  < Entity Index of Contact < Entity Index of Support Ticket.


Adding Date fields


To add a date field, choose the Data Type as Date
  • Within the forms, the date field will have a Javascript based date-picker to help enter the date value.
  • The date fields will also be automatically indexed, so that users can create custom views based on date fields with dynamic filtering criteria, to create views like Due TodayDue Next Week, Due Next Month, etc.,.
  • Adding date fields will automatically enable Calendar views for that field.

Adding Date and Time fields


To add a date and time field, choose the Data Type as Date and Time

Similar to the date field, 
  • Within the forms, the date-time field will have a Javascript based date-time-picker to help enter the date-time value.
  • The date-time fields will also be automatically indexed, so that users can create custom views based on date-time fields with dynamic filtering criteria, to create views like Due TodayDue Next WeekDue Next Month, etc.,.
  • Adding date-time fields will automatically enable Calendar views for that field.

Adding Number (Integer) fields


To store numeric values as part the database records, you can either define the attribute to have a integer / float type. Integers are positive or negative numbers without decimal points, while float type can have decimal values.

To use the integer types, choose the Data Type as Number (Integer). You can further configure the field to fall within specific range by providing the values for

Min Value : The minimum value allowed in this field.
Max Value : The maximum value allowed in this field.


Adding Decimal numbers (Float) fields


To store numeric values as part the database records, you can either define the attribute to have a integer / float type. Integers are positive or negative numbers without decimal points, while float type can have decimal values.

To use the decimal types, choose the Data Type as Decimal numbers (Float). You can further configure the field to fall within specific range by providing the values for 

Min Value : The minimum value allowed in this field.
Max Value : The maximum value allowed in this field.
Scale : The maximum number of decimal positions to be allowed after the decimal point.


Adding Image fields


To add a image field, you just have to choose the Data Type as Image. Additional configuration Maximum File Size (KB) (under Image Attribute Details) specifies that iFreeTools can allow files up to that size and if the size is bigger, the image will automatically be reduced in size to meet the maximum file size constraint. For the free version, the allowed values for the maximum file size (in KB) are 10, 25, 50 and 75. For paid versions (single-tenant deployments) the allowed values for maximum file size (in KB) are 10, 25, 50, 75, 100, 250 and 500.

For more details on how the image fields feature works, you can check out this blog post :
Image fields now supported in the Free Online Database builder for Google Apps


Adding Geographical Location (GeoPoint) fields


To add a GeoPoint field, select the Data Type as Geographical Location (GeoPoint)

For more details on the features enabled for GeoPoint fields, you can check out this blog post :
Building a Store Locator type Google Maps app over GAE, using iFreeTools, where-in we walk-through the process of building a database with a GeoPoint field.


Adding List (with String values) fields


To add a List field, which can have String values, select the Data Type as List (with String values). There are 2 modes in which the list field take in values in forms : Either as
Both these options are detailed below.


Adding Normal list fields (allows arbitrary values)

To add a normal list field, you will have to do nothing more than selecting the Data Type as List (with String values). An empty Choice Values configuration will make the forms to provide a simple text box where values can be entered as comma-separated values. Example value 1, value 2, value 3 and they will internally be stored as a list [value 1, value 2, value 3](list-format is representational only), within Google's BigTable.

To know more about using List fields, check out the following blog post :
"List" data type, now supported in Online Database App Creator

Adding Multi-select list fields (restricts values to given choice values)

To add a multi-select list field, apart from selecting the Data Type as List (with String values), you will also have to provide values in the Choice Values configuration of the attribute. For example, if the values are provided as choice 1, choice 2, choice 3, then the form will show a check for each of the choice values.

Something like

and if choice 1 and choice 3 are selected the value of the list will be [choice 1, choice 3](list-format is representational only).

To know more about using List fields, check out the following blog post :
"List" data type, now supported in Online Database App Creator


Creating computed formula fields


Within iFreeTools Creator, you can define attributes to have values which are computed based on formulas. Under the Advanced section in the form, you will find an option to specify the Formula Expression, which you can provide using supported operators and functions.

You can also set an Alias for the attributes, so as to refer to them using the alias within expressions.

For more details on using expressions refer to the following page :
Using Expressions for Formula-fields and Validations


Defining Validations


When you would like to validate the value entered by the user in the forms, you can make use of the Validation Expression, to specify the expression which needs to evaluate to True, when adding the record. Within the validation expression, you can refer to the current value of the field as inputValue.

For example to check if the text inputValue is has a length of 10 letters, you can have the validation expression as len(inputValue) == 10. Or to check if the numeric integer value is a multiple of 10, you can have the validation expression as inputValue % 10 == 0.

For more details on using expressions refer to the following page :
Using Expressions for Formula-fields and Validations


Creating fields with unique values


When you mark an attribute as unique, iFreeTools will validate the values to ensure that there are no duplicates for that field. This facility is enabled for Single-line text (String) and Number (Integer) fields.

For more details, kindly refer to the following blog post:
Support for Unique Field Constraints in iFreeTools


Marking fields as Mandatory


During form submission, if an attribute should not be left empty, you can mark as checked the Requires Value configuration for that attribute to ensure the same.



Declaring Default Values


If you would like to have a default-value for the attribute, which gets filled-in automatically when the form is loaded, so that it can be left as-is or edited if required before submitting the form, you can specify the Default Value Expression for that attribute.

For this expression, you may provide static values or dynamic values based on expressions, including expressions that can fetch data from the database.

Example :

Data TypeSample expression for default value
Numbers (Integer/Decimal)1
-2
33.5
-44.75

are all valid values. You can also specify any expression that can evaluate to numeric value.
Yes / No (Boolean)True
False


or any expression that can evaluate to True or a False
Single/Multi-line Text (String)'Some Text Value in single quote'
"Or in double quotes"

or any expression that can evaluate to a text value.
List of String["List", "of", "Text", "values"]

or any expression that can evaluate to list of text values.
Geographic Location (Geo Point)"12.975322, 80.220715"

or any expression that can evaluate to a text value in the given format.
Datetoday()
date(2013, 1, 1)

or any expression that can evaluate to a date value.
Date and Timenow()
datetime(2013, 1, 1, 14, 30, 00)

or any expression that can evaluate to a date-time value.
ImageYou can use an expression to fetch the key-id to another image field value, which is currently in the database.

Example :
key_id(val_from(fetch_one("Ent1", {"AttrX":"Y"}), "ImgAttrName"))

where Ent1 refers to another entity having attributes AttX which is used for filtering and ImgAttrName, which store image references.

Detailed explanation of the above expression :
  1. fetch_one("Ent1", {"AttrX":"Y"}) will fetch one record from Ent1 entity, having AttrX's value as "Y". Let us assume the result of this inner expression to be fetched_record.
  2. val_from(fetched_record, "ImgAttrName") will get the value of the attribute with name ImgAttrName from the record fetched from database. Let us take this to be image_attr_value.
  3. key_id(image_attr_value)will provide the key-id for the image reference. 
Look-up (Reference)You can use an expression to fetch the key-id to an existing entry in database.

Example :
key_id(fetch_one("ReferencedEnt1", {"AttrX":"Y"}))

where ReferenceEnt1 refers to another entity having attribute AttrX which is used for filtering out a record having AttrX as "Y".

Detailed explanation of the above expression :
  1. fetch_one("Ent1", {"AttrX":"Y"}) will fetch one record from Ent1 entity, having AttrX's value as "Y". Let us assume the result of this inner expression to be fetched_record.
  2. val_from(fetched_record, "ImgAttrName") will get the value of the attribute with name ImgAttrName from the record fetched from database. Let us take this to be image_attr_value.
  3. key_id(image_attr_value)will provide the key-id for the image reference. 

For more details on using expressions refer to the following page :
Using Expressions for Formula-fields and Validations

If you have any specific queries when using attributes, always feel free to use the feedback-form in the app to get in touch with us.