Create Local Database

Navigation:  Quick Start Guides > Phone Storage Based App >

Create Local Database

Previous pageReturn to chapter overviewNext page

Local database means the data which resides on user's device. User can add, remove or edit the Local database of the application.

 

1. Create local Database:

 

To add the local database in the application follow the steps below:

 

Step 1: Click on the Project Icon.

 

mobilous_appexe_console_applications_neweditproject_icon_created

 

Step 2: Click on "Edit" button from the below dialog box.

 

mobilous_appexe_console_applications_neweditproject_icon_edit

 

Step 3: Click on the "DataBase Manager" button from the Applications page.

 

mobilous_appexe_console_applications_newedit_databasemanager

 

Step 4: From the Database manager page user needs to click on the "Add Table" button of the local data base table.

 

mobilous_appexe_console_applications_neweditproject_database_local

                         

Step 5: User will see the Local Database table over lay.

 

mobilous_appexe_console_applications_neweditproject_localdatabase_add

 

 

Step 6: The user will have to enter the "Table name" and the "Description" of the table in the table name and description fields. It’s mandatory for a user to enter the table name.

 

User needs to provide the following field details for the table.

 

Parameters

Description

Primary

Primary means that this field has unique value. For e.g  "id" of every person is unique and cant be same.

Note: User can select more than one field as Primary Key.

Auto Increment

An auto increment field can be checked only if the type selected is integer. Auto Increment means the data will be automatically incremented by 1.

Index

User can select one or more than one field as Index. Index helps searching faster when large amount of data is stored in Database.

Field Name

It is the name of the field.

Field Type

Allows to select type of the field. It can be "Integer", "Text", "Date", "Boolean", "Real", "Time", "DateTime".

 

Integer: An integer is a number that can be written without a fractional or decimal

component. For e.g 21, 4, and −2048 are integers.

 

Text: Text can be alphanumeric (Combination of alphabetic and numeric characters). For e.g "address1".

 

Date: The format of date in the CSV file should be YYYY-MM-DD.

 

Boolean: Boolean data type is a data type, having two values (usually denoted true and   false).

 

Real: A real is a number that includes both integer −5 and fraction 4/3.

 

Time: The format of Time in the CSV file should be HH:MM: ( SS ).

 

DateTime: The format of DateTime in the CSV file should be YYYY-MM-DD HH:MM: ( SS ).

 

Default Value

Default value is the value which is taken in the database in case no value is passed for a particular field.

Note:

1.For "Text" Field type, Default value is always NULL.

2.In Update Action , Default value for Date, Time, DateTime and Integer are NULL.

Description

Brief description of the field can be added.

 

mobilous_appexe_console_applications_neweditproject_localdatabase_fieldset

 

 

 

 

 

Please note that:

1. The name of the table should never have spaces, should be in lower case and not have any special characters like - “, ‘:;./?><=+-*&%$#@!`~][}{\|

2. If the table name has to have two or more than two words, then the user can add an underscore sign ”_” between the words.

3. There are some reserved words which can not be used as the Table Name. To know more about Reserved Words click here.

 

Step 7: Click on the provided "Add row" button to add the Table Fields. A new row will be added to the overlay.

 

mobilous_appexe_myproject_sbsg_phonestorage_database_local

 

 

 

 

Similarly the user can add any number of fields in the database.

 

Note:

1. One field must be defined as primary.

2. The field name can not be the reserved words. Please click here to know more about reserved words.

3. If the user wants to delete the field from the table the user can click on the delete icon on the over lay.

4. User can click on "Reset" button to reset the fields and refill the Table Information.

 

Step 8:  After adding all the fields click "Save" button. On clicking on the save button the over lay will be closed and the table name will be added to local database.

 

mobilous_appexe_console_applications_neweditproject_localdatabase_created

 

2) Upload data in local Database:

 

User needs to follow the below mentioned steps to add a data in the table.

 

Step 1: User needs to click on the download icon that was appearing in the Actions column of the local Database table.

 

mobilous_appexe_console_applications_neweditproject_localdatabase_download

 

Step 2: When the user clicks on the "Download" button the csv file will be downloaded to the system i.e. a Comma Separated Value file will be downloaded to the user system where the user can fill the records.

 

mobilous_appexe_console_applications_neweditproject_localdatabase_downloadfile

 

Step 3: Save the file on your machine and open the file and enter the record details and save the file in the same format.

 

User can manually enter the data or can copy and paste it from other excel file.

 

mobilous_appexe_myproject_sbsg_localdatabase_csv

 

Step 4: Click on the "UTF-8 (CSV)" button to upload the file.

 

mobilous_appexe_console_applications_neweditproject_localdatabase_loadcsv

 

 

Step 5:  On clicking on the "UTF-8 (CSV)" button the page will navigate to the Data base manager table information page. User needs to click on the "Choose File" and choose the csv file.

 

mobilous_appexe_myproject_sbsg_localdatabase_choosecsv

 

 

 

Step 6: Click on the "Upload" button the data in the csv file will be appearing here. Click Next to proceed which will redirect the user to the Database manager page.

 

mobilous_appexe_myproject_sbsg_localdatabase_csvupload