Sei sulla pagina 1di 148

MobiForms V6.

0 Manual For Google Android

Manual V6.0 28/05/2011. Copyright www.mobiforms.com 2011.

Contents
1.0 Introduction ........................................................................................................................................6 2.0 Using This Manual .............................................................................................................................7 2.1 Summary Of New Features In MobiForms Version 6.0 .................................................................7 3.0 MobiForms Environmental Requirements..........................................................................................8 3.1 MobiForms Developer....................................................................................................................8 3.2 MobiForms Runtime.......................................................................................................................8 3.2.1 Windows PC Or Apple Mac Clients........................................................................................8 3.2.2 Apple iPhone, iPad and iPod Clients .......................................................................................8 3.2.3 Google Android Clients ...........................................................................................................8 3.2.4 Windows Mobile and Other Clients ........................................................................................8 4.0 Installing MobiForms On A PC........................................................................................................10 5.0 MobiForms Developer......................................................................................................................12 5.1 The File Pull-Down Menu ............................................................................................................12 5.2 The Deploy Pull-Down Menu.......................................................................................................12 5.3 The Database Pull-Down Menu....................................................................................................13 5.4 The Help Pull-Down Menu ..........................................................................................................13 5.5 The Top Toolbar ...........................................................................................................................13 5.6 The Object Navigator ...................................................................................................................14 5.7 The Application Layout Windows................................................................................................14 5.8 The Properties Palette ...................................................................................................................14 5.8.1 The Form Properties Palette ..................................................................................................14 5.9 The MobiForms Runtime Windows .............................................................................................17 5.10 Conversion Of Complex Data Types To Simplified MobiForms Data Types............................17 6.0 MobiScript........................................................................................................................................18 6.1 Navigation, Querying And Saving................................................................................................18 6.2 Assignments..................................................................................................................................18 6.3 Programmically Getting Or Setting Object Attributes..................................................................19 6.4 Mathematics..................................................................................................................................19 6.5 File Access....................................................................................................................................20 6.6 Date And Time Manipulation .......................................................................................................20 6.7 Timers...........................................................................................................................................21 6.8 If And End If Evaluation Statements ............................................................................................21 6.8.1 Evaluating AND Conditions..................................................................................................22 6.8.2 Evaluating OR Conditions .....................................................................................................22 6.9 Loop And End Loop Statements...................................................................................................22 6.10 Pausing A Trigger.......................................................................................................................22 6.11 Stopping A Trigger .....................................................................................................................22 6.12 Message Alerts ...........................................................................................................................22 6.12.1 Standard Message Alert .......................................................................................................22 6.12.2 Stop Message Alert..............................................................................................................23 6.13 Executing Operating System Commands ...................................................................................23 6.14 Executing External Java Classes.................................................................................................23 6.15 Printing Bar Codes......................................................................................................................23 6.16 TCP/IP Socket Communications ................................................................................................24 6.16.1 Server Commands................................................................................................................24 6.16.2 Client Commands ................................................................................................................24 6.17 Calling Forms .............................................................................................................................25 6.18 Sending Email.............................................................................................................................25 6.19 Smartphone Special Features......................................................................................................26 6.19.1 Camera Support ...................................................................................................................26 6.19.2 GPS Support ........................................................................................................................26 7.0 Signature Capture Or Sketching .......................................................................................................27 7.1 The Save Button ...........................................................................................................................27 7.2 The Clear Button ..........................................................................................................................28 7.3 The Read Button ...........................................................................................................................28 7.4 Running On A Google Android Smartphone................................................................................28 8.0 Image Items ......................................................................................................................................29 8.1 Changing Images With The Post Query Trigger ..........................................................................29

8.2 Runtime Path Considerations........................................................................................................29 9.0 Working With Google Android Smartphones ..................................................................................30 9.1 Configuring The USB Driver .......................................................................................................30 9.1.1 USB Debugging Mode ..........................................................................................................30 9.1.2 The Hardware Update Wizard ...............................................................................................30 9.1.3 Confirming The USB Device Installation..............................................................................34 9.2 Google Android Considerations ...................................................................................................34 9.2.1 Screen Size ............................................................................................................................34 9.2.2 Object Background Colours...................................................................................................34 9.2.3 File Locations ........................................................................................................................34 9.2.4 MobiForms Icon ....................................................................................................................34 9.2.5 Drawings................................................................................................................................35 9.2.6 MobiForms Menus.................................................................................................................35 10.0 The NONE Database Tutorial.........................................................................................................36 10.1 Creating A New Form ................................................................................................................36 10.2 Changing The Form Properties...................................................................................................37 10.3 Changing The Window Properties..............................................................................................38 10.4 Creating A List ...........................................................................................................................38 10.5 Creating A Field .........................................................................................................................40 10.6 Creating A Button.......................................................................................................................41 10.7 Adding Hidden Fields.................................................................................................................43 10.8 Adding Button Triggers ..............................................................................................................43 10.9 Saving The Form ........................................................................................................................44 10.10 Running The Form On The PC.................................................................................................45 10.10.1 The Save Button ................................................................................................................47 10.10.2 The Exit Button..................................................................................................................47 10.10.3 The Refresh Button............................................................................................................47 10.10.4 The View Button................................................................................................................47 10.11 Preparing To Run On A Google Android Smartphone .............................................................48 10.12 Deploying The Form To The Google Android Smartphone .....................................................48 10.12.1 The Install LNK Tab..........................................................................................................49 10.12.2 The Install FML Tab..........................................................................................................49 10.13 Running The Form On The Google Android Smartphone........................................................49 11.1 The Client Server Architecture ...................................................................................................51 11.2 The Master Jobs Form ................................................................................................................51 10.2.1 The Save Button ..................................................................................................................51 11.2.2 The Refresh Button..............................................................................................................52 11.3 The Server Form .........................................................................................................................52 11.3.1 The Listen Trigger ...............................................................................................................53 11.3.2 The Stop Trigger..................................................................................................................53 11.4 The Jobs Client Form..................................................................................................................53 11.4.1 The View Trigger ................................................................................................................54 11.4.2 The Refresh Trigger.............................................................................................................54 11.4.3 The Save Trigger .................................................................................................................55 11.5 Running The Application............................................................................................................56 11.6 A Note On Client Server Applications .......................................................................................59 12.0 The HSQLDB CUSTOMER Tutorial.............................................................................................60 12.1 Creating A New Form ................................................................................................................60 12.2 Connecting To The Database......................................................................................................61 12.3 Applying Google Android Parameters........................................................................................63 12.4 Applying A Base Table To A block ...........................................................................................63 12.5 Adding A New List Item ............................................................................................................64 12.6 Adding A New Field...................................................................................................................65 12.7 Adding A New Button ................................................................................................................66 12.8 Adding A Button Trigger............................................................................................................67 12.9 Block Where Clause ...................................................................................................................67 12.10 Saving The Form ......................................................................................................................68 12.11 Running The Form....................................................................................................................68 12.12 Querying Records .....................................................................................................................69 12.13 Exiting The Form......................................................................................................................69

12.14 Deploying The Form To The Google Android Smartphone .....................................................69 13.0 Advanced MobiForms Features For HSQLDB ..............................................................................71 13.1 Protecting Fields With The Updateable Attribute.......................................................................71 13.2 Validating Duplicates In A Field ................................................................................................71 13.3 MobiForms Runtime Modes.......................................................................................................72 13.3.1 Query Mode .........................................................................................................................72 13.3.2 Insert Mode..........................................................................................................................72 13.3.3 Update Mode .......................................................................................................................73 13.3.4 Delete Mode ........................................................................................................................73 13.4 Hidden Fields..............................................................................................................................73 13.5 Colour Palette .............................................................................................................................75 13.6 Font Chooser...............................................................................................................................77 13.7 The Limitations Of The HSQLDB Examples.............................................................................78 14.0 The Oracle EMPS Tutorial .............................................................................................................79 14.1 Creating A New Form ................................................................................................................79 14.2 Connecting To The Database......................................................................................................80 14.3 Applying A Base Table To A block ...........................................................................................82 14.4 Adding A New List Item ............................................................................................................82 14.5 Adding A New Field...................................................................................................................83 14.6 Adding A New Button ................................................................................................................85 14.7 Adding A Button Trigger............................................................................................................85 14.8 Block Post Query Trigger ...........................................................................................................86 14.9 Block Where Clause ...................................................................................................................86 14.10 Saving The Form ......................................................................................................................86 14.11 Running The Form....................................................................................................................87 14.12 Querying Records .....................................................................................................................88 14.13 Exiting The Form......................................................................................................................88 14.14 Deploying The Form.................................................................................................................88 15.0 Advanced MobiForms Features For Oracle....................................................................................89 15.1 Protecting Fields With The Updateable Attribute.......................................................................89 15.2 Protecting Fields With The Enabled Attribute............................................................................89 15.3 Validating Duplicates In A Field ................................................................................................89 15.4 Validating Against A Reference Table .......................................................................................90 15.5 MobiForms Runtime Modes.......................................................................................................91 15.5.1 Query Mode .........................................................................................................................91 15.5.2 Insert Mode..........................................................................................................................92 15.5.3 Update Mode .......................................................................................................................92 15.5.4 Delete Mode ........................................................................................................................92 15.6 Hidden Fields..............................................................................................................................92 15.7 Colour Palette .............................................................................................................................94 15.8 Font Chooser...............................................................................................................................96 16.0 The SQL Server EMPS Tutorial.....................................................................................................98 16.1 Creating A New Form ................................................................................................................98 16.2 Connecting To The Database......................................................................................................99 16.3 Applying A Base Table To A block .........................................................................................101 16.4 Adding A New List Item ..........................................................................................................101 16.5 Adding A New Field.................................................................................................................102 16.6 Adding A New Button ..............................................................................................................104 16.7 Adding A Button Trigger..........................................................................................................104 16.8 Block Post Query Trigger .........................................................................................................105 16.9 Block Where Clause .................................................................................................................105 16.10 Saving The Form ....................................................................................................................105 16.11 Running The Form..................................................................................................................106 16.12 Querying Records ...................................................................................................................107 16.13 Exiting The Form....................................................................................................................107 16.14 Deploying The Form...............................................................................................................107 17.0 Advanced MobiForms Features For SQL Server .........................................................................108 17.1 Protecting Fields With The Updateable Attribute.....................................................................108 17.2 Protecting Fields With The Enabled Attribute..........................................................................108 17.3 Validating Duplicates In A Field ..............................................................................................108

17.4 Validating Against A Reference Table .....................................................................................109 17.5 MobiForms Runtime Modes.....................................................................................................110 17.5.1 Query Mode .......................................................................................................................110 17.5.2 Insert Mode........................................................................................................................111 17.5.3 Update Mode .....................................................................................................................111 17.5.4 Delete Mode ......................................................................................................................111 17.6 Hidden Fields............................................................................................................................111 17.7 Colour Palette ...........................................................................................................................113 17.8 Font Chooser.............................................................................................................................115 18.0 Installing MobiForms On A Google Android Smartphone Using The Deployment Wizard........117 18.1 The JVM Option .......................................................................................................................117 18.2 The LNK Option.......................................................................................................................118 18.3 The FML Option.......................................................................................................................119 18.4 The Database Option ................................................................................................................120 19.0 Google Android Camera Tutorial .................................................................................................122 19.1 Creating A New Form ..............................................................................................................122 19.2 Configuring The Window Size .................................................................................................123 19.3 Adding A Field .........................................................................................................................123 19.4 Form Trigger.............................................................................................................................124 19.5 Adding A Camera .....................................................................................................................124 19.6 Comments On Cameras ............................................................................................................124 19.7 Adding Camera Buttons ...........................................................................................................125 19.8 Deploying The Form.................................................................................................................125 20.0 Multi-Record Blocks ....................................................................................................................126 21.0 Sample Forms ...............................................................................................................................127 22.0 Future Options ..............................................................................................................................127 23.0 Support .........................................................................................................................................127 24.0 Licence Agreements And Acknowledgements .............................................................................128 Appendix A Installing The HTC Sync Utility And USB Driver .......................................................136 A.1 Installing the HTC Sync Utility .................................................................................................136 A.2 Connecting The Smartphone......................................................................................................139 Appendix B - Installing HSQLDB .......................................................................................................141 B.1 Downloading HSQLDB .............................................................................................................141 B.2 Configuring HSQLDB For MobiForms .....................................................................................141 Appendix C Configuring SQL Server ...............................................................................................144 C.1 The SQL Server Configuration Manager ...................................................................................144 C.2 The SQL Server Managament Studio Express...........................................................................145 C.3 Restart The SQL Server Services...............................................................................................146 C.4 Verify Connection By SQL Server Authentication....................................................................147 C.5 Install The MobiForms Demo Tables ........................................................................................147

1.0 Introduction
Following a detailed survey of the programming tools market, MobiForms was developed to plug the gap in the market for a simple rapid application development (RAD) tool for wireless applications. MobiForms is a RAD tool for developing mobile database applications running on just about any wireless platform including PDA, smartphone, tablet or laptop. The latest version of MobiForms now supports Google Android smartphones with this separate dedicated manual. MobiForms is aimed at novice and expert programmers alike who do not want to spend hours learning and writing complex low level code like Java or C++. MobiForms uses Java behind the scenes, but the Java layer is totally hidden. The user does not need to know a single line of Java. MobiForms is a totally intuitive graphical drag and drop development environment. MobiForms can also be used to create standard PC or Apple Mac based applications. The latest version of MobiForms supports many Google Android specific features including the built-in camera and GPS. The Google Android platform lends itself particularly well to MobiForms because it has an embedded Java Virtual Machine (JVM) called Dalvik. Unlike Windows Mobile a separate JVM is not required. Up until now, developing for Android required the following items: Download/learn Eclipse Download/learn Android SDK Eclipse Plug-in Learn Java Learn XML Learn DroidDraw GUI Tool Learn Android Tools - Emulator and Debug Bridge Learn JDBC, resultsets and SQL

Within one tool MobiForms replaces all of the above. MobiForms For Google Android has been certified to run against a range of databases including Standard and Enterprise Oracle Server, Microsoft SQL Server and HSQLDB. More databases will be certified soon. The HSQLDB certification enables the creation of applications requiring a local smartphone database. Additionally, MobiForms can be run without a database, but instead file reading and writing commands from the in-built simple MobiScript language can be used to save and retrieve data from any ASCII formatted file. Moiom of sa t t l i oeofrt c ao o ayt eo m b eap ct n b r s f r l h o s n n bx o h r t n f n y f oi plao. F e l e o e ei p l i i MobiForms consists of a development tool called MobiForms Developer. The product of the tool is a special version of XML called Forms Mark-up Language in files with a FML extension. The FML file is both the source code repository for a mobile application and the runtime file that the MobiForms runtime interpreter uses to run the application. MobiForms includes the free open-source HSQLDB database enabling the creation of server, standalone or mobile database applications. HSQLDB is the database engine in OpenOffice.org 2.0, soon to appear on millions of desktops around the world. MobiForms is also certified with the HXSQL database a commercial drop in alternative to HSQLDB. This document aims to teach the user by example by building a simple application based on the wellknown Oracle sample EMP and DEPT tables. The SQL Server tutorials use a version of the Oracle EMP and DEPT tables. Alternatively, there are several examples such as signature capture that use simple ASCII files instead of a database to store data. These simple examples demonstrate the speed of MobiForms compared to traditional development tools. This is the true value of MobiForms. The MobiForms runtime interpreter automatically takes care of Java result set processing and cursor handling allowing the programmer to focus on high-level SQL queries and the application look and feel. MobiForms offers simple file synchronisation capabilities between a mobile client and server using some of the advanced MobiScript commands. This is discussed in detail in the Advanced Client Server Application section of this document. An additional MobiForms Sync Server option for Google Android will soon be available to solve table and record level database synchronisation and reconciliation issues between a mobile HSQLDB database and any master server database listed above.

Oracle, Sybase and other vendors also provide server tools to do this. The MobiForms simple file synchronisation is often sufficient for most requirements.

2.0 Using This Manual


Different users will use this manual in different ways according to their needs with the following recommendations: Recommended reading: Section 3.0 MobiForms Environment Requirements Section 4.0 Installing MobiForms On A PC Section 5.0 MobiForms Developer Section 6.0 MobiScript Section 7.0 Signature Capture Or Sketching Section 8.0 Image Items Section 9.0 Working With Google Android Smartphones Section 19.0 Google Android Camera Tutorial Section 20.0 Multi-Record Blocks Section 21.0 Sample Forms Section 10.0 The NONE Database Tutorial Section 11.0 Advanced Client Server Application Section 18.0 Installing MobiForms On A Smartphone Using The Deployment Wizard Appendix B Installing HSQLDB Section 12.0 The HSQLDB CUSTOMER Tutorial Section 13.0 Advanced MobiForms Features For HSQLDB Section 18.0 Installing MobiForms On A Smartphone Using The Deployment Wizard Section 14.0 The Oracle EMPS Tutorial Section 15.0 Advanced MobiForms Features For Oracle Section 18.0 Installing MobiForms On A Smartphone Using The Deployment Wizard Appendix C Configuring SQL Server Section 16.0 The SQL Server EMPS Tutorial Section 17.0 Advanced MobiForms Features For SQL Server Section 18.0 Installing MobiForms On A Smartphone Using The Deployment Wizard

Creating simple applications without a database:

Creating applications with the HSQLDB database:

Creating applications with the Oracle database:

Creating applications with the SQL Server database:

2.1 Summary Of New Features In MobiForms Version 6.0 Version 5.05 of MobiForms incorporated the following new features: In Developer added form level attributes author, version and web_site. These are updatable for h eae vro ol wi l l ei n . t b sn y For HSQLDB 2.0 select from information_schemea. At runtime added execute_trigger for :block.button or :block.image. Added upper on go_block. Version 6.0 incorporates the following new features: In Developer at form level added device iPhone/iPad/iPod and JVM/OS Apple iOS. Enabled camera object for Apple iOS devices. Made editor_window resizable. For SQLite date format use strftime.

3.0 MobiForms Environmental Requirements


3.1 MobiForms Developer Operating System Java Runtime Environment Database (optional) Windows 98, 2000, 2003, XP, Vista, Windows 7 onwards Apple OS X Snow Leopard onwards 1.4 onwards Windows: - Oracle Server 8.1.7 onwards, Oracle Lite 4.0 onwards - Sybase SQL Anywhere 9 onwards - IBM DB2 Universal Database Server 8.2 onwards - SQLite 3.0 onwards - HSQLDB 1.8.0.7 onwards - HXSQL 1.8.0.7 onwards (drop in alternative to HSQLDB) - MySQL 5.0 onwards - Microsoft SQL Server 6.5, 7, 2000, 2005 onwards plus Express Edition Apple OS X: - SQLite 3.0 onwards

3.2 MobiForms Runtime 3.2.1 Windows PC Or Apple Mac Clients As above. 3.2.2 Apple iPhone, iPad and iPod Clients Operating System Local Database (optional) 3.2.3 Google Android Clients Operating System Java Virtual Machine Local Database (optional) Remote Database (optional) Google Android Dalvik HSQLDB 1.8.0.7 onwards Oracle Server 8.1.7 onwards MySQL 5.0 onwards Microsoft SQL Server 6.5, 7, 2000, 2005 onwards plus Express Edition iOS 4 onwards SQLite 3.0 onwards

3.2.4 Windows Mobile and Other Clients Operating System Java Virtual Machine Local Database (optional) Tablet PC, Pocket PC, Windows CE, Windows Mobile or Symbian NSIcom CreEme, Esmertec Jbed, Esmertec Jeode, Symbian PersonalJava, IBM J9, Mysaifu, Sun phoneme etc Oracle Lite 4.0 onwards Sybase SQL Anywhere 9 onwards (Pocket PC and Windows CE only) HSQLDB 1.8.0.7 onwards HXSQL 1.8.0.7 onwards (drop in alternative to HSQLDB) Oracle Server 8.1.7 onwards Sybase SQL Anywhere 9 onwards IBM DB2 Universal Database Server 8.2 onwards SQLite 3.0 onwards MySQL 5.0 onwards Microsoft SQL Server 6.5, 7, 2000, 2005 onwards plus Express Edition

Remote Database (optional)

T er o dt aeapoc i a oko na ln Sre m d. T eoe t gss m ad h e t a bs prah s l nw s Ci t e r oe h pr i yt s n m e a s e v an e JVMs described above have been certified with MobiForms. Other combinations have been certified by their suppliers and so should also support MobiForms.

4.0 Installing MobiForms On A PC


The MobiForms development environment will run on most Windows clients with an installed Java Runtime Environment (JRE) version of 1.4 of above. If the Windows client does not have a Java Runtime Environment then it can be downloaded from the http://java.sun.com web site. MobiForms will also check to see that the client has the minimum Java version installed. Download MobiForms from the http://www.mobiforms.com web site. It comes as a self-extracting zip file called mobiforms60.exe. Place the mobiforms60.exe in a suitable temporary directory like c:\temp and double click on it. A handful of files will be extracted including the setup.exe file. Double click on the setup.exe file to run the MobiForms installer:

The installer creates a Programs menu option called MobiForms containing the MobiForms Developer, the MobiForms Manual, the Uninstall MobiForms and the HSQLDB Manager icons. Behind the see a e e o fe wlb et c dt t : cns sr s fis i e x at o h C\Program Files\Moiom o e o a sr e nd i l l r e e b r sfl r r ue df e F d i destination. Files of particular interest are listed below: File ASA9-TCPIP.lnk Description The ASA9-TCPIP.lnk is a link file for Pocket PC or Windows CE to start Sybase SQL Anywhere with a TCP/IP listener. The TCP/IP listener is required for the Sybase jConnect JDBC driver. The EmpsDB2.fml is provided for reference purposes as an example of the file generated in the IBM DB2 based EMPS Tutorial discussed later in this document. The EmpsOracle.fml is provided for reference purposes as an example of the file generated in the Oracle based EMPS Tutorial discussed later in this document. The EmpsSybase.fml is provided for reference purposes as an example of the file generated in the Sybase based EMPS Tutorial discussed later in this document. Folder called examples containing sample forms listed in Section 19.0. The hsqldb.exe is the main HSQLDB executable. A short cut can be made to this file on the Windows Desktop. The hsqldb.jar provides the necessary JDBC driver to support MobiForms running against HSQLDB. This jar has been re-compiled against Java 1.3.1. The jtds-1.2.2.jar provides the necessary JDBC driver to support MobiForms running against SQL Server. The mobi.gif file is used as the icon file by the MobiForms Developer.

EmpsDB2.fml

EmpsOracle.fml

EmpsSybase.fml

examples hsqldb.exe hsqldb.jar

jtds-1.2.2.jar mobi.gif

10

mobidev.exe Mobidev.jar MobiForms.aif MobiForms.app MobiForms.lic

MobiForms.txt MobiFormsOracleCrEme.lnk

MobiFormsOracleJeode.lnk

MobiFormsSybaseCrEme.lnk

MobiFormsSybaseJeode.lnk

MobiForms60.pdf MobiForms60g.pdf MobiForms60i.pdf mobirun.exe Mobirun.jar

Mobirung.apk rcmd.exe SigCap.fml sqlitejdbc-v056.jar usb_driver

The mobidev.exe is the main MobiForms Developer executable. A short cut can be made to this file on the Windows Desktop. The Mobidev.jar is the Java runtime file called by mobidev.exe. The MobiForms.aif file provides support for Symbian devices along with MobiForms.app and MobiForms.txt. The MobiForms.app file provides support for Symbian devices along with MobiForms.aif and MobiForms.txt. The encrypted MobiForms.lic licence file. The contents determines whether MobiForms will run in trial or licenced mode. Trial mode lasts for 30 days. Licenced mode is unrestricted. The MobiForms.txt file provides support for Symbian devices along with MobiForms.aif and MobiForms.app. The MobiFormsOracleCrEme.lnk file is provided as an example shortcut link that can be used on the mobile device running Oracle Lite with the CrEme JVM. The MobiFormsOracleJeode.lnk file is provided as an example shortcut link that can be used on the mobile device running Oracle Lite with the Jeode JVM. The MobiFormsSybaseCreme.lnk file is provided as an example shortcut link that can be used on the mobile device running Sybase SQL Anywhere with the CrEme JVM. The MobiFormsSybaseJeode.lnk file is provided as an example shortcut link that can be used on the mobile device running Sybase SQL Anywhere with the Jeode JVM. The MobiForms60.pdf is the MobiForms 6.0 manual in Acrobat Reader PDF format. The dedicated MobiForms 6.0 Manual For Google Android in Acrobat Reader PDF format. The dedicated MobiForms 6.0 Manual For Apple iPhone in Acrobat Reader PDF format. The mobirun.exe is provided to allow MobiForms applications to be run on the host client independently of the MobiForms Developer. The Mobirun.jar is the Java runtime file called by mobirun.exe. Additionally, it can be called from the MobiForms Developer or run standalone on a mobile device from a lnk link file. The Google Android MobiForms runtime file. Remote command executable used by the MobiForms Developer to deploy files to Windows Mobile and Pocket PC/CE devices. The SigCap.fml is provided as an example of a simple form for signature capture or viewing. It does not need access to a database. The sqlitejdbc-v056.jar provides the necessary JDBC driver to support MobiForms running against SQLite. Folder called usb_driver containing the standard Google Android Windows USB Driver.

MobiForms requires a pre-installed JDBC compliant database to be present, if database access is needed. Appendix B describes the installation and configuration of HSQLDB on a Windows PC. Appendix C describes the configuration of SQL Server necessary to support access using MobiForms.

11

5.0 MobiForms Developer


To run the MobiForms Developer double click on the MobiForms Developer icon in the Programs menu MobiForms option. A typical MobiForms environment will look like the following screen shot:

The main components of the MobiForms Developer are: 5.1 The File Pull-Down Menu Consists of the following options: New Open Save Close Connect Disconnect Run Exit Creates a new form with the default name of FORM1. Opens a previously saved form FML (Forms Mark-up Language) File. Saves the current form changes to the specified file. Closes the current form changes. Invokes the connect dialogue window defaulting to the database defined in the form properties. Disconnects the current database session. Runs the current saved file. Exits MobiForms Developer.

5.2 The Deploy Pull-Down Menu Enabled for Windows Mobil, Pocket PC/CE and Google Android MobiForms applications. It consists of the following options: JVM This shows the JVM installation tab of the Deployment Wizard. From here the user selects the location of the preferred mobile Java Virtual Machine (JVM) installation file. The Install button checks for the presence of a mobile device connected via ActiveSync and initiates the installation of the JVM. This shows the LNK installation tab of the Deployment Wizard. From here the user selects the chosen JVM. The Install button copies over a short-cut LNK file to the mobile device and the necessary MobiForms runtime environment files. This shows the FML installtion tab of the Deployment Wizard. From here the user selects the chosen JVM. The Install button copies over the MobiForms application FML file to the mobile device. This shows the Database installation tab of the Deployment Wizard. The location of the database to be copied is displayed. The install button copies over the database

LNK

FML

Database

12

files from the location on the development PC to the equivalent location on the mobile device. This tab is only enabled for the HSQLDB database option. The location path is inherited from the database connect string. The connect string must not contain a drive letter or a space character. 5.3 The Database Pull-Down Menu This menu is only enabled for the HSQLDB database option. It consists of the following option: Admin This calls the external HSQL Database Manager tool as follows:

5.4 The Help Pull-Down Menu Consists of the following option: About Information about the current version of MobiForms.

5.5 The Top Toolbar Consists of the following options: Creates a new Window enabled only when cursor is at form level in the Object Navigator. New Multi-Record Block Creates a new multi-record Tabular Block enabled only when cursor is at window level in the Object Navigator. New Single Record Block Creates a new single record Form Block enabled only when cursor is at window level in the Object Navigator. New Button Creates a new Button enabled only when cursor is at block level in the Object Navigator. New Field Creates a new Field enabled only when cursor is at block level in the Object Navigator. New Label Creates a new Label enabled only when cursor is at block level in the Object Navigator. New List Creates a new List enabled only when cursor is at block level in the Object Navigator. New Window

13

New Check Box New Drawing New Image New Camera

Delete Item

Creates a new Check Box enabled only when cursor is at block level in the Object Navigator. Creates a new Drawing enabled only when cursor is at block level in the Object Navigator. Creates a new Image enabled only when cursor is at block level in the Object Navigator. Creates a new Camera enabled only when cursor is at block level in the Object Navigator and when the form level JVM/OS attribute is set to a i o pliS. D l k rA p O v e Deletes any item with no children in the Object Navigator.

5.6 The Object Navigator A hierarchical tree of all the objects that define a form. Clicking on any item shows its properties in the Properties palette. MobiForms has the following object hierarchy: Form Window Tabular Block Form Block Button Camera Check Box Drawing Field Image Label List Incorporates a Scrollbar (For database record navigation) Incorporates a Label Incorporates a Label (Google Android, iPhone, iPad and iPod) Incorporates a Label Incorporates a Label Incorporates a Label Incorporates a Label Incorporates a Label

A form can have many windows. A window can have many form blocks. A form block can have many items. 5.7 The Application Layout Windows Every MobiForms application will have at least one window to display the components to the user when run. MobiForms provides an application layout window for each runtime window where the user can define, drag and drop components to the desired locations. 5.8 The Properties Palette Shows a tabular list of attributes that describe an object on a form. The Properties palette appears if the mouse is clicked on the Object Tree or directly on the item in its window in the middle of the desktop. 5.8.1 The Form Properties Palette The form has the following properties: Name Defines the unique name of the form. This name is also used for the name of the FML file where the form definition is stored on the development PC. Defaults to Form for the form properties view. Double clicking on this will cycle the runtime date format on DATE fields with the following values: dd/MM/yyyy dd-MM-yyyy MM/dd/yyyy MM-dd-yyyy dd.MM.yyyy

Type Date Format

14

Database Type

Double clicking on this will cycle the development and runtime database connection type through the following values: Oracle Lite Oracle Server Sybase jConnect Sybase iAnywhere IBM DB2 Universal IBM DB2 Type 2 HSQLDB SQLite MySQL SQL Server Microsoft Access NONE Note that the Sybase iAnywhere database type can potentially support a JDBC connection to any ODBC compliant database defined by a DSN (Data Source Name). This list covers most of the common databases available. Should there be one not on the list the MobiForms team would be happy to consider adding it on request. Additionally a value of NONE allows MobiForms to run without connecting to a database and the developer to create an application that just reads and writes to ASCII text files in any format like CSV.

Connect String

The connect string for database access. This is usually in the JDBC connection format. This is not required when the Database Type is NONE. The following table lists the connect strings formats appropriate for each database connection type with the MobiForms short format or the standard long format: Connect String jdbc:polite:<database> e.g. jdbc:polite:polite <machine>:<port>:<service_or_sid> e.g. server1:1521:ora92 or 192.168.0.1:1521:ora92 Note that the MobiForms Connect String is a subset of the jdbc:oracle:thin:@server1:1521:ora92 <machine>:<port> e.g. server1:2638 or localhost:2638 Note that the MobiForms Connect String is a subset of the jdbc:sybase:Tds:server1:2638 <DSN> e.g. ASA 9.0 Sample Note that this is an ODBC connect string. jdbc:db2:<database> e.g. jdbc:db2:sample jdbc:db2:<database> e.g. jdbc:db2:sample file:<path> e.g. file:\hsqldb\testdb Note that the MobiForms Connect String is a subset of the jdbc:hsqldb:file:\hsqldb\testdb jdbc:sqlite:<path> e.g. jdbc:sqlite:c:\sqlite\testdb //<machine>/<database> e.g. //192.168.0.23/menagerie Note that the MobiForms Connect String is a subset of the jdbc:mysql://192.169.0.23/menagerie //<machine>:<port>/<database> e.g. //server1:1030/master Note that the MobiForms Connect String is a subset of the jdbc:jtds:sqlserver://server1:1030/master Blank

Connection Type Oracle Lite Oracle Server

long form e.g.

Sybase jConnect

long form e.g.

Sybase iAnywhere IBM DB2 Universal IBM DB2 Type 2 HSQLDB

long form e.g.

SQLite MySQL

long form e.g.

SQL Server

long form e.g.

NONE Sync Connect String

An HSQLDB formatted connect string in the HTTP form e.g. jdbc:hsqldb:http://server1:81/syncserv. Must be left blank unless using a mobile HSQLDB database and the remote MobiForms Sync Server option. Not currently supported with MobiForms For iPhone.

15

Trigger

User specific MobiScript commands for automatic start up processing such as implementing default values into fields. Double clicking on this will cycle the setting between the values of True and False. If set to True, all dragged items in a window will lock into a virtual grid separated by 10 pixels in the x and y directions. Double clicking on this will cycle the default device type through the following values: Mysaifu IBM J9 5.X (Websphere Everyplace Micro Environment) IBM J9 5.X (Websphere Everyplace Micro Environment) NSI CrEme (PersonalJava Edition) Esmertec Jeode/Jbed Symbian PersonalJava Dalvik Apple iOS Sun JRE Sun phoneME

Grid Snap

JVM/OS

Default Device

Double clicking on this will cycle the default device type through the following values: Windows Mobile Pocket PC/CE Windows PC Tablet PC EPOC/Symbian Palm Google Android iPhone/iPad/iPod

The values of JVM and Default Device are interdependent. The valid combinations of JVM and Default Device are as follows: JVM Mysaifu Mysaifu IBM J9 5.X (Websphere Everyplace Micro Environment) IBM J9 5.X (Websphere Everyplace Micro Environment) IBM J9 6.X (Websphere Everyplace Micro Environment) IBM J9 6.X (Websphere Everyplace Micro Environment) NSI CrEme (PersonalJava Edition) NSI CrEme (PersonalJava Edition) Esmertec Jeode/Jbed Esmertec Jeode/Jbed Symbian PersonalJava IBM J9 5.X (Websphere Everyplace Micro Environment) IBM J9 6.X (Websphere Everyplace Micro Environment) Dalvik Apple iOS Sun JRE Sun JRE Size Factor Default Device Windows Mobile Pocket PC/CE Windows Mobile Pocket PC/CE Windows Mobile Pocket PC/CE Windows Mobile Pocket PC/CE Windows Mobile Pocket PC/CE EPOC/Symbian Palm Palm Google Android iPhone/iPad/iPad Windows PC Tablet PC

User definable size factor applied against all objects to increase their size in the same proportion.

16

Comments Author Version Web Site

User specific comments about the form. D f l b om U dt lwtt h eae vro. e u Moi r s. pa b i h w i l l e i at F ae h e t b sn D f l. . pa b wtt h eae vro. e u 6 U dt l i h w i l l e i at 0 ae h e t b sn D f l w .oi r s o U dt lwtt h eae vro e u w wm b om . m . pa b i h w i l l e i at f c ae h e t b s n.

5.9 The MobiForms Runtime Windows Additionally, once an application has been saved it can be run from MobiForms and display its own runtime windows. 5.10 Conversion Of Complex Data Types To Simplified MobiForms Data Types The field object in the Field Poe y a t hs a T p rpr . h hs n o t e vl s rpr Plt a a D t ye poe y T i a oe fh e a e: t ee a t s r u H R , N MB R ad A E .I odrospot u i e a bs t e wt cm l dt C A U E n D T n re t uprm lp dt ae y s i o p x a tl a p h e a types MobiForms does the conversion to the simplified data types as below. This conversion is done w e t ue dulccs n h a e poe y f f l lt r hc bx o hwai o t l hn h sr ob lk o t N m rpr o a id i o cek o t so lt fa e e e i e t e ,s s b cl n frh b c bs t l It r in df e cne i adt t eicne e t t o m s o t l ks ae a e fh e s o e nd ovro u e o b. e i s n a y s ovr d o h a p t e df ldtt e fC A e u a y oH R. at a p Complex Data Type DATE TIME DATETIME TIMESTAMP CHAR VARCHAR2 LONG RAW RAW LONG BLOB GLOB VARCHAR LONG VARCHAR NUMBER DECIMAL NUMERIC INTEGER INT UNSIGNED INT TINYINT SMALLINT BIGINT UNSIGNED BIGINT BINARY LONG BINARY VARBINARY DOUBLE FLOAT Simple Data Type DATE DATE DATE DATE CHAR CHAR CHAR CHAR CHAR CHAR CHAR CHAR CHAR NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER

17

6.0 MobiScript
MobiScript is used on button, image and form triggers to automate navigation and data driven events in an application and create a more rewarding experience for the user. The form level trigger can be used to control the start up of an application and to define for example default values in certain fields. Each command must be suffixed with a semicolon (;) and can be prefixed with space characters to make the code more readable. A trigger can be built up of many commands. MobiScript supports navigation, database querying and saving, assignments, mathematical expressions, file access, execution of operating system commands, if/end_if evaluation statements, loops and TCP/IP socket communications. Note that using the space character either side of the equals (=) sign in assignments and mathematical expressions is not supported. Multiple combinations of commands applied to one text field in the same statement are also not supported. It is intended that in future releases MobiScript trigger statements will be extended to the pull-down menus so that their default functionality can be over-ridden. 6.1 Navigation, Querying And Saving clear_block; commit; or commit_form; enter_query; execute_query; execute_trigger(:block1.item); exit_form; first_field; go_block(:block1); next_block; next_field; next_record; previous_block; previous_record; 6.2 Assignments :control.deptno=:emp.deptno; :control.deptno=:emp.1; :control.deptno=chr(65); Assigns the value from the DEPTNO field in the EMP block to the DEPTNO field in the CONTROL block. Assigns the value of column 1 in the EMP multi-record block to the DEPTNO field in the CONTROL block. Assigns the value of the DEPTNO field in the CONTROL b c t t ca c r A r r et l k o h hr t e e n dby the ASCII code o e ae ps e 65. Assigns the substring of the value in the DEPNTO field in the EMP block to the DEPTNO field in the CONTROL block. Assigns the literal value to the DEPTNO field in the CONTROL block. Appends the data in the DEPTNO field in the EMP block to the data in the DEPTNO field in the CONTROL block. A pnsh ca c r A r r et b t A CI oe ped t hr t e e n d y h S Icd e ae ps e e 65 to the data in the DEPTNO field in the CONTROL block. A pnst ca c r A t t dt i t D P N ped h hr t o h a n h E T O e ae e a e field in the CONTROL block. Clears the DEPTNO field in the CONTROL block. Sets the DEPTNO in the CONTROL block to the value in the field currently containing the cursor. Clears all the data in the current block and places the application in Insert Mode. Saves the data to the database Places the current block in Query Mode.. Executes a query in the current form block. Executes the trigger on a button or image item. Exits the application. Navigates cursor to first field in current block; Navigates cursor to the data block called block1. Navigates cursor to the next data block. Navigates cursor to the next field in the current block. Next record in query results. Navigates cursor to the previous data block. Previous record in query results.

:control.deptno=substr(:emp.deptno,1,2); : nrl eto 0; c t . p =1 o od n :control.deptno=+:emp.deptno; :control.deptno=+chr(65); : nrl eto +A; c t . p = o od n : nrl eto c t . p = o od n ; :control.deptno=get_field;

18

st id; e fl _ e ()

Clears the value in the field currently containing the cursor. set_field(:control.deptno); Sets the field currently containing the cursor to the value in the DEPTNO field in the CONTROL block. : nrlo tgt b c : p eto fn c t . n= e oj te . p ,o t; o of _ e (m d n ) Sets the FONT in the CONTROL block to the value of the font attribute of the :emp.deptno field. st b c : p eto fn_i 1 Sets the font_size attribute of the :emp.deptbo field to 10. e oj te . p ,o t z , 0) _ e (m d n s e ; st b c : o t lid fn_i 1 e oj t: nr .e ,o t z , 0) _ e (c o f l s e ;Sets the font_size attribute of the name of the block field held in the :control.field field to 10. st b c n_i 1 e oj tf t z , 0) _ e (,o s e ; Sets the font_size attribute of the field currently containing the cursor to 10. 6.3 Programmically Getting Or Setting Object Attributes The get_object and set_object commands are used to programmatically get or set the following object attributes: Field name (get_object only) label font font_size font_colour fill_colour (Not supported on Google Android) label_colour enabled maxiumum_characters value font font_size font_colour fill_colour (Not supported on Google Android) enabled label label font font_size font_colour name (get_object only) file_name file_name (set_object only)

Button

Label

Image Drawing

6.4 Mathematics Simple maths expressions can be applied to NUMBER text fields. Note that MobiScript checks the data type of a field. A plus (+) on a CHAR field will append whilst a plus on a NUMBER field will mathematically add. : nrl eto +1; c t . p = o od n :control.deptno+1; :control.deptno=- 1; :control.deptno=-1; : nrl eto *2; c t . p = o od n Adds 1 to the value in the DEPTNO field in CONTROL block. Adds 1 to the value in the DEPTNO field in CONTROL block. Subtracts 1 to the value in the DEPTNO field in CONTROL block. Subtracts 1 to the value in the DEPTNO field in CONTROL block. Multiplies the value in the DEPTNO field in CONTROL block by 2. the the the the the

19

:control.deptno=*2;

Multiplies the value in the DEPTNO field in the CONTROL block. : nrl eto / c t . p = ; o od n 2 Divides the value in the DEPTNO field in the CONTROL block by 2. :control.deptno=/2; Divides the value in the DEPTNO field in the CONTROL block by 2. :control.total2=round(:control.total1,2); Rounds the value in the TOTAL1 field in the CONTROL block to 2 decimal places returning the result in TOTAL2. 6.5 File Access Coe t fe fea ex fred g l sh i l m .t o r i . s e l in t an Coe t fe fea ex for writing or appending. l sh i l m .t s e l in t D le t fe fea ex . e t h i l m .t e s e l in t Deletes the file named in the :control.file_name field. R as h dt cn i di t i N m poperty of ed t a otn n h Fl a e r e a ae e e the drawing object :control.drawing and draws it onto the canvas of the drawing object. The file must be in the MobiForms drawing format. This command opens and closes the file as well and therefore no other additional commands are necessary. opn apn (in m . t; e_pedl a ex ) fe t O es i l a ex fr ri adayw is i pn fe fe m .t o w in n n re wl l in t tg t l be appended at the end of the file. The file must already exist. oe_edl a ex ) pn ra(in m . t; fe t O es i l a ex fred gbg n ga t t pn fe fe m .t o r i ei i th o l in t an nn e p of the file. open_w i(in m . t; re fea ex ) t l t O es i l a ex fr ri bg n ga t t pn fe fe m .t o w in ei i th o l in t tg nn e p of the file. This command can be used to create or over write an existing file. read(:control.deptno); Reads the contents of one line (ending with a Carriage Return character) into the DEPTNO field in the CONTROL block. save_drawing(:control.drawing, image.png); Saves the image of drawing object :control.drawing to PNG encoded file image.png. save_drawing(:control.drawing, image.jpg); Saves the image of drawing object :control.drawing to JPEG encoded file image.jpg. w i( b re ac ; t ) Wre adapnsh si b oa om l oee is n ped t tn ac t fr ay pnd t e rg l file. write(chr(10)); Writes and appends the ASCII code for Carriage Return to a formally opened file. write(:control.deptno); Writes the contents of the DEPTNO field in the CONTROL block to a formally opened file. close_read; close_write; dlefe fea ex ) e t i(in m . t; e _ l l t delete_file(:control.file_name); load_drawing(:control.drawing); Note that only one file can be open for reading and one additional file for writing at any one time. 6.6 Date And Time Manipulation :control.date=DATE; :control.time=TIME; :control.year=YEAR; :control.month=MONTH; :control.day=DAY; A s n t a dt t t : s gs o ys a o h control.date field in the i d e e default date format applied at form level e.g. 25/12/2005. Assigns the current time to the :control.time field in the 24 hour clock format e.g. 23:59. Assigns the current year to the :control.year field in the Y2K format e.g. 2005. Assigns the current month to the :control.month field in t r g auro D cm e . h a e Jna t ee br e n y Assigns the current day to the :control.day field in the r g nao S na a e Mody t udy. n

20

:control.hour=HOUR; :control.min=MINUTE; :control.sec=SECOND; :control.ms=MILLISECOND;

Assigns the current hour to the :control.hour field in a format between 00 and 23. Assigns the current time element of minutes to the :control.min field in a format between 00 and 59. Assigns the current time element of seconds to the :control.sec field in a format between 00 and 59. Assigns the current time element of milliseconds to the :control.ms field in a format between 0 and 999.

Any of the assignments above can e pedd s gh i ot C A f l e . b apne ui t + s n n H R id . n e g o es g :control.time_with_seconds=HOUR; :oto.iewt_eod= cnrltm_ihscns+:; :control.time_with_seconds=+MINUTE; :oto.iewt_eod= cnrltm_ihscns+:; :control.time_with_seconds=+SECOND; 6.7 Timers A standard 5 character CHAR field must be used as a displayable timer. A time in minutes and seconds is returned in the format MM:SS. The following commands are used to control a timer: start_timer(:control.timer); stop_timer; reset_timer; Starts or continues a timer and displays the results into the :control.timer field. Stops the timer and halts the display in the previously defined :control.timer field. R stt t e t 0 0.T cag t d p yvl ee h i ro 0: o hne h i l a e s em 0 e sa u of the timer the following command must be additionally exeu d . : n o t e 0 0; ct e . ot li r 0: e g c r .m = 0

6.8 If And End If Evaluation Statements If and end_if evaluation is constructed as follows: ifX(condition) statement; end_ifX; E c / di s t et ut eg e anm e w e i bten1ad 5. T ah ie _ te n m s b i n u br X hr X s e e fn f a m v e w n 0 he nm e n ss mao s b c p t dawtm lp ad et / di s t et u br g yt l w Moi r to el i u i e n ns d ie _ te n . i e l Si h tl e fn f a m s T e cnios fh fl wn fr a h od i io t o o i om t tn e l g : :l k h rf l tn b c. a_id Sr g o c e= i :block.number_field=123 :block.char_field1=:block.char_field2 C a c rid b c. a f l eultn hr t f l : ok hr id qa Sr g. a e e l c _e s i Number field :block.number_field equals 123. Character field :block.char_field equals character field :block.char_field2. :l k h rf l =Sr g b c. a_id tn o c e! i C a c rid b c. a f l ntqat tn hr t f l : ok hr id o eulo Sr g. a e e l c _e i :block.number_field!=123 Number field :block.number_field not equal to 123. :block.char_field1!=:block.char_field2 Character field :block.char_field not equal to character field :block.char_field2. :block.number_field>123 Number field :block.number_field greater than 123. :block.number_field>:block.number_field2 Number field :block.number_field1 greater than number field :block1.number_field2; :block.number_field<123 Number field :block.number_field less than 123. :block.number_field<:block.number_field2 Number field :block.number_field1 less than number field :block1.number_field2; T ete et cncn i oeo m r Moic p cm ad adi eeu dol w e t h s t n a otn n r oe b r t o m ns n s xct n hn h am a Si e y e od i ru etvl t t t e cnio a m nea a so r . tn g ue u

21

6.8.1 Evaluating AND Conditions MobiScript does not explicitly suppor A D cniosbt a b ah vdb ns d / di t N od i t n u cn e ci e y et ie _ e e fn f clauses e.g. :lc1ca_il1; bok.hrfed=A :lc1ca_il2 bok.hrfed=B; i1:lc1ca_il1 f(bok.hrfed=A) i2:lc1ca_il2 f(bok.hrfed=B) msaeil1AADFed=; esg(Fed= N il2B) end_if2; end_if1; 6.8.2 Evaluating OR Conditions Moic p de nt xliyspot R cnios u cnb ah vdb sqetl iedi b r t os o ep cl uprO od i bt a e ci e y eun a / _ Si it tn e i fn f claues e.g. :lc1ca_il1; bok.hrfed=A :lc1ca_il2 bok.hrfed=B; i1:lc1ca_il1 f(bok.hrfed=A) so_esg(Fed= O Fed=; tpmsaeil1A R il2B) end_if1; i2:lc1ca_il2 f(bok.hrfed=B) so_esg(Fed= O Fed=; tpmsaeil1A R il2B) end_if2; 6.9 Loop And End Loop Statements Loops are constructed as follows: loopX(N) statement; end_loopX; E c o/ dl p s t et ut eg e anm e w e i bteen 1 and 9. The ah l p n_ o te n m s b i n u br X hr X s e o e o am v e w nm e n ss mao s b c p t dawtm lp ad et o/ dl p s t et u br g yt l w Moi r to el i u i e n ns d l p n_ o te n . i e l Si h tl e o e o am s The parameter N is the number of times the loop will cycle for. T e s t et cncn i oe r oe b c p cm ad adieeu d for each loop cycle. h te n a otn n o m r Moi r t o m ns n s xct am a Si e At ;cm ad s ue l ehn mt j p uo aop s p o m n ia sf m cai o u ot f l . o u s m o 6.10 Pausing A Trigger A trigger can be paused by the use of the pause clause as follows: pause(N); Where N is the time for the pause in milliseconds. 6.11 Stopping A Trigger A trigger can be stopped by using the stop clause as follows: stop; 6.12 Message Alerts Two kinds of messages can be achieved with MobiScript. 6.12.1 Standard Message Alert A standard message alert will display a message string or the contents of a field as an alert. Processing does not stop e.g. msaeANN! Ti msae wl so i a aet bt poesn esg(WRIG hs esg il hw n n lr, u rcsig de ntso.) os o tp;

22

message(:block1.field1); 6.12.2 Stop Message Alert A stop message alert will display a message string or the contents of a field as an alert. Processing of the remainder of the trigger is stopped. This kind of alert is useful for error type messages e.g. so_esg(ERR Ti msae wl so i a aet ad so te tpmsaeRO! hs esg il hw n n lr n tp h tigr; rge.) stop_message(:block1.field1); 6.13 Executing Operating System Commands execute_os('notepad filename.txt'); Loads the filename.txt into Notepad in a Windows 95 or 98 system. execute_os('cmd /c notepad filename.txt'); Loads the filename.txt into Notepad in a Windows NT, 2000, 2003 or XP system. execute_os('55#"\Windows\pword.exe" \orace\ filename.txt'); Loads the filename.txt into Pocket Word in a Windows CE or Pocket PC system. 6.14 Executing External Java Classes execute_java('Calc', :block1.x, :block1.y, :block1.z); Loads externally created Calc class in Calc.jar, passing the contents of fields :block1.x and :block1.y returning the results to field :block1.z. The execute_java command currently supports the passing of two variables and the returing of one result. The following Java code lists a simple example routine working with the above command: public class Calc { static int result; public static void main( String args[] ) { new Calc(args[0], args[1]); } public Calc(String x, String y) { result = Integer.parseInt(x) + Integer.parseInt(y); System.out.println("" + result); } } If the Calc.jar is in the same folder that Mobirun is launched from, then it is automatically found. Otherwise, it must be added to the class path e.g: c:\<your jdk path>\bin\java.exe "c:\temp\Mobirun.jar; cp c:\temp\Calc.jar" Mobirun calc.fml Where calc.fml is also in the c:\temp directory. Note that Java and the execute_java command are not supported on Apple iOS. 6.15 Printing Bar Codes Most bar code printers support a formatting language so that the programmer can build label templates very easily. The de facto standard for most modern bar code printers is the Zebra Printer Language (ZPL) even for those not made by Zebra. You do not need to have special bar code label printer drivers or software to create labels. The following text defines a simple label as shown: ^XA^XFFORMAT^FS ^FN1^FDLABEL ONE^FS

23

^FN2^FDAAA001^FS ^XZ

To format and print this label with MobiForms in Windows 2000 the following button trigger could be defined: oe_rt(otiett) pnwieufl.x; wieX^FOMTF; rt(^AXFRA^S) wieF1FLBLOEF; rt(^N^DAE N^S) wieF2FAA0^S) rt(^N^DA01F; wieX; rt(^Z) close_write; eeueo(cd/ cp otiettlt:) xct_sm c oy ufl.x p1; Alternatively you could use the execute_os command for all of the lines: eeueo(eh ^AXFRA^S>otiett) xct_sco X^FOMTF ufl.x; eeueo(eh ^N^DAE OEF > otiett) xct_sco F1FLBL N^S > ufl.x; eeueo(eh ^N^DA01F > otiett) xct_sco F2FAA0^S > ufl.x; eeueo(eh ^Z> otiett) xct_sco X > ufl.x; eeueo(cp otiettLT:) xct_soy ufl.x P1; 6.16 TCP/IP Socket Communications MobiScript contains a rich set of statements to enable TCP/IP socket communications over serial cables, wired networks or wireless networks. 6.16.1 Server Commands open_server('8000'); open_server(:control.port); Opens a TCP/IP socket on port 8000. Opens a TCP/IP socket on port number identified in the :control.port field. start_listener(:control.received, :control.sent); Starts listener on previously opened socket. Any received commands or strings are appended to the :control.received field. An acknowledgement string is sent from the :control.sent field. start_listener(:control.received, ''); Starts listener on previously opened socket. Any received commands or strings are appended to the :control.received field. No acknowledgement string is returned. stop_listener; Stops a previously started listener. close_server. Closes a previously opened TCP/IP socket. 6.16.2 Client Commands open_client('127.0.0.1', '8000'); Opens a TCP/IP client session with server identified by IP address 127.0.01 and listening on port 8000. open_client(:control.ip_address, :control.port);

24

Opens a TCP/IP client session with server identified by IP address :control.ip_address and listening on port :control.port. client_send_string(:control.field1); Sends string from field :control.field1 to the server. client_get_string(:control.field2); Requests string to field :control.field2 from the server. client_get_file_string('out\file1.txt', :control.field3); Requests remote file u i1 x t f l : n o f l . ot l .t o id c t lid \fe t e o r .e 3 client_get_file('out\file1.txt', 'in\file1.txt'); R qet r o fe u i1 x t l a fe eus e t i ot l .t o o l i s m e l \fe t c l \fe.t i i1 x . n l t client_send_file('out\file2.txt', 'in\file2.txt'); Snsoafeoti2 x t r o fei i2 x . ed l li u l .t o e t i \fe.t c l \fe t m e l n l t local_directory('in', 'in\filelist.txt'); Ls t cn n o l a d et y i o fe is h ot t f o l i c r i n i t e es c r o n t l \fest i iltx . n li.t local_directory('in', :control.file_list); Lst cn n o l a d et y n t lt b c i h ot t fo l i c r i i o h i oj t t e es c r o n t es e :control.file_list. local_dir_filter('in', 'in\filelist.txt', 'csv'); Ls fe wt a s sfc i t oad et y n isis i cv uf en h i l l i c r i o t l h i en c r o t fei iltx . i \fest l n li.t local_dir_filter('in', :control.file_list, 'csv'); Ls fe wt a s sfc i t oad et y isis i cv uf en h i l l i c r into t l h i en c r o the list object :control.file_list. remote_directory('in', 'in\filelist.txt'); Ls t cn n o l a d et y i o fe is h ot t f o l i c r i n i t e es c r o n t l \fest i iltx . n li.t remote_directory('in', :control.file_list); Lst cn n o l a d et y n t lt i h ot t fo l i c r i i o h i object t e es c r o n t es :control.file_list. close_client; Closes a previously opened TCP/IP client session. 6.17 Calling Forms The MobiScript command run_form allows multi-form applications to be created. It is possible to create a parent menu form with a list of buttons calling different child forms. It is also possible to pass data between forms using a parameter. Example parent form calls include: rn fr ( U Tf l; u _om S . C m ,) rn fr ( U Tf lB u _om S . A C) C m , ; rn fr ( U Tf l: nrloe u _om S . c t . d) C m ,o oc ; rn fr ( o t lom a e u _om : nr . r n m ,) c of ; Calls the CUST.fml form with a blank passed parameter. Call t C S . lfr wt B a t ps d s h U Tf om i A C s h as e m h e e parameter. Calls the CUST.fml form with the value contained in the CODE field in the CONTROL block as the passed parameter. Calls the form name contained in the FORMNAME field in the CONTROL block with a blank passed parameter.

The child called form will pick up the passed parameter by an assignment in the form Start Trigger using the special :parameter reserved word e.g. :control.code=:parameter; Sets the value of the CODE field in the CONTROL block to the passed parameter from the parent form run_form command.

6.18 Sending Email The MobiForms send_email command is designed to send data back from a client application using the SMTP email protocol. The send_email command has the following parameters which can be literals in quotes or MobiForms fields using the :block.field convention: Parameter Mail Server Port Sender Recipient Subject Body File Description The destination SMTP email server IP address or server name. The destination SMTP email server port and is usually 25. The email address of the sender. The email address of the recipient. The subject of the message. The body text of the message. An optional attachment file such as a signature image file.

25

An example of the send_email command is as follows: sn_mi(st.2cm,2nombfrscm,spotmbfrs edealmpo.o5,if@oiom.oupr@oiom .omotn Msae,Pes fn yu ipratdt fl cm,Iprat esglae id or motn aa ie atce.,fl1gf) tahdie.i; 6.19 Smartphone Special Features For the Google Android and Apple iOS platforms MobiScript contains some additional hardware specific commands. 6.19.1 Camera Support take_picture(:block1.camera1,:block1.field1); Fires the smartphone camera and transfers the contents of the preview in the :block1camera1 object to a file name contained in :block1.field1. take_picture(:block1.camera1, '\sdcard\image001'); Fires the smartphone camera and transfers the contents of the preview in the :block1camera1 object to a file image001.jpg in the sdcard folder. reset_camera(:block1.camera1); Resets the :block1.camera1 object and enables preview mode again. This is not required for Apple iOS devices. 6.19.2 GPS Support enable_gps; Enables GPS support in a MobiForms app. This should be fired once per app run and is best placed in the form level trigger. Reads the current location from the smartphone GPS receiver and transfers the data as a coordinate pair to the numeric fields :block1.lat and :block1.long. Reads the current location from the smartphone GPS receiver as a coordinate pair and interrogates the smartphone map service over the internet to return the nearest address as a string into the :block1.field1. For display purposes it is best to set the :block1.field1 as a multi-line field.

get_lat_long(:block1.lat,:block1.long);

get_location(:block1.field1);

26

7.0 Signature Capture Or Sketching


The MobiForms install file includes the SigCap.fml file. This file contains a simple example of signature or sketch saving, reading and clearing using three buttons. The following screen shot shows this application loaded in the MobiForms Developer:

I t s xm l t oj t R WI G hs a bs I m poe yo Fl adai N m n h ea p h b c D A N 1 a a D t ae t rpr f a e n i e e e a e t s Fl a e e poe y fi a.t T e e u x hr t s poe ys et 20. tseo m ne t tf rpr o s cp x h df l Ma C a c r rpr isto 00 Iir m edd h i t g t. at ae t c a a drawing object is made a database item then the reference column in the table must match the Name o t im adhv a l s am n u cl nwd eul rl grt t xC a c r f h t n ae t e t i m m o m i h qa o a e o h Ma hr t s e e a i u t r e ae property. Drawing items are unique in MobiForms in being able to be saved to a database table cl n a i o bt a alcl n n a i.T e cm i b c p s t et i sv t t o m , fe r o t e o m ad fe h o m t Moi r tte n wl aeo h u l h b u l ; S i am l e appropriate place based on the properties of the drawing object. In the above example there are three buttons: 7.1 The Save Button T e Sv u o hsh fl wn r gr poe y h ae bt n a t o o i Ti e rpr : t e l g g t commit; Pes g h l r bt n u t fr i IsrMoet n sh ue ccs n m vs s l o r i t Ce u o pt h om n ne sn e a t s e t d,h a t sr lk ad oe a t u n e e i ys the drawing canvas a dot or line is drawn as follows:

O pes gt ae bt nt dt iw ie adsvdi ot s cp x fe T e a is r n r i h Sv u o h a s rt n ae n h i a.ti. h dt s t e sn e t e a tn t e g t l a od as x and y coordinates of the start and end points of a series of lines. This is a more efficient method of saving the data than using an image file.

27

7.2 The Clear Button T e Cer bt n a t fl wn r gr poe y h l u o hsh o o i Ti e rpr : a t e l g g t clear_block; Whnh l r bt ns r sd h da i cna ic a d e t Ce u o ipe e t r n avss l r . e a t s e w g ee 7.3 The Read Button T e R a u o hsh fl wn r gr poe y h ed bt n a t o o i Ti e rpr : t e l g g t load_drawing(:block1.drawing1); Whnt ed bt nipesdt s cp x feioee fr ed g t dt ir di ot e h R a u o s r e h i a.ti s pnd o r i ,h a s e n h e t s e g t l an e a a t e drawing buffer, the data is drawn on the drawing canvas :block1.drawing1 and the sigcap.txt file is closed. Note that this MobiScript command can only be used to load drawing data from a file. The file must be in the MobiForms format. If a drawing object has the Database property set to True then the execute_query; command can be used to load the drawing object automatically from the database. 7.4 Running On A Google Android Smartphone On a Google Android Smartphone the form runs as follows. Note that the version of the MobiForms runtime client on Google Android is 5.05.

28

8.0 Image Items


MobiForms now includes image items that can read BMP, JPG or GIF images. The example below so s nm g imcld MA E ui ai cld l o pnh Moiom D vl e hw a i aet ae I G 1 s g fe ae g. g it e l n l l o j e b r s ee pr F o :

The file name can be typed or chosen from a list that looks in the MobiForms working directory. 8.1 Changing Images With The Post Query Trigger Images can be changed at runtime by the Post Query trigger at block level. A char column in a database containing an image name can be selected into a block based image item. 8.2 Runtime Path Considerations The MobiForms Developer can use a relative path to display an image, however, if the application is intended to be run on a mobile device an absolute path for the device may be necessary and can be typed into the File Name field e. fr okt CadWi o s b e \temp\logo.jpg or for Google g o P ce P n . n w Moi d l A do da / g. g. nri / cr l o p d s do j

29

9.0 Working With Google Android Smartphones


9.1 Configuring The USB Driver MobiForms includes the MobiForms Deployment Wizard which is used to copy the MobiForms runtime and application files to the Smartphone. In order for this to work the Google Android USB driver must be configured first. To remove any configuration conflicts it is recommended that any other flavour of smartphone USB connectivity is removed such as Microsoft ActiveSync for Windows Mobile devices. 9.1.1 USB Debugging Mode In order for the Smartphone to be detected by a PC the USB Debugging Mode must be permanently enabled. Switch on the phone, press the Menu button, choose the Settings option, scroll to and choose the Applications option, choose the Development option and check the USB debugging option, and finally press the OK button. Plug in the phone to PC via the USB cable. The PC should respond by recognising that a new device has been installed and go through the process of adding a new USB device. The Hardware Update Wizard should be displayed automatically. The following sequence discusses the installation of the standard Google Android USB driver. Alternatively, the manufacturer of the device may provide an equivalent driver. Appendix A discusses the installation of the HTC Sync Utility and USB driver. 9.1.2 The Hardware Update Wizard

Choose the "No, not this time" option and press the Next button:

30

Choose the "Install from a list or specific location (Advanced)" option and press the Next button:

Choose the "Don't search. I will choose the driver to install." option and press the Next button:

31

Press the Have Disk button:

Press the Browse button and select the usb_folder folder from the c:\program files\mobiforms folder:

Select the android_winusb.inf file:

32

Press the OK button:

C os t nri C m oi A BIt f e ad hoeh A do o pse D n r c n press the Next button: e d t ea

Press the Finish button.

33

9.1.3 Confirming The USB Device Installation On the PC go to the Control Panel and double click on the System icon. Click the Hardware tab and choose the Device Manager button to display the following:

If the installation has been successful the Android Composite ADB Interface will be displayed as above. 9.2 Google Android Considerations 9.2.1 Screen Size The screen size on current Google Android smartphones varies from 240 x 320 to 320 x 480 pixels. The default window size in the MobiForms Developer is 240 x 320. Where the screen size on Google Android is bigger the developer can choose to increase the size of each window, items and font manually, or more conveniently the Form level Size Factor can be used. To convert a 240 x 320 MobiForms layout to the Android 320 x 480 simply apply a screen Size Factor of 1.4. 9.2.2 Object Background Colours For Windows Mobile the MobiForms Developer allows for the background colours of items such as buttons and text fields to be changed, however, for Google Android the backgrounds of these items cannot be changed in the MobiForms Developer or programmatically via the set_object MobiScript built-in. The Google Android Graphical User Interface is more sophisticated than for other environments and does not currently allow backgrounds to be programmatically changed. This may change in future versions. 9.2.3 File Locations When a Google Android smartphone is connected via a USB connection to a PC the only folder on the device that is visible to the PC is the SDCARD, usually as Windows drive d:\. By default the MobiForms Deployment Wizard installs the MobiForms runtime into a hidden folder at the heart of the Google Android operating system, however, the MobiForms application FML file is installed into the SDCARD accessed from MobiFor s s / cr Lk e p o Wi o s b et da s m a da . i \t n n w Moi,h / cr i s d e m d l e s d guaranteed to be available on all Google Android smartphones and is a convenient location for any o e fe t t b om ue.T e/ crso ea p t r o m ne l ao fr t rish Moi r s ss h da ifr xm l h e m edd o t n o signature h l a F s d e e c ci cp r fe.T e / crs l t ol l ao o a og ado s a poehta b se at e is h da ia sh n o t n n G ol nri m r hn t cn e en u l s d o e y ci e d t a by a connected PC. 9.2.4 MobiForms Icon The MobiForms Deployment Wizard installs the MobiForms runtime and application FML file. It also cr t a i n o t ap ct n n h s a poe por s eu ae b ug.C r n y t e e n c frh plao i t m r hn rga m n cld Moi n ur t i as o e i i e t s m l r el is not possible to change this icon from within MobiForms, however, there are third party apps aaal t t cn b ue t r a e sot t sc a ps O gn e a vib l e h a a e sd o e m n hr u c s uh s A p rai r t z h :se. olse psrai r rA y u . t/is og /tapogn e o nC t t/t g e i/ z

34

9.2.5 Drawings For a drawing object MobiForms offers the save_drawing MobiScript built-in. For Google Android smartphones this supports saving files to the PNG or JPG formats. 9.2.6 MobiForms Menus Each MobiForms window can be defined with or without the standard menu. When this property is set to True the menu is accessed via the Menu button below the screen as follows:

Sub-menus are displayed like the following for the Action menu:

35

10.0 The NONE Database Tutorial


The aim of this tutorial is to build a simple client application that does not connect to a third party database, but instead uses ASCII files. Double click on the MobiForms Developer icon in the Programs menu MobiForms option. The following screen is presented: 10.1 Creating A New Form

Choose the File pull-down menu and select the New option:

A new window and block appear. The window width and height are measured in pixels with the defaults set to 240 by 320 the minimum size of a Google Android smartphone screen.

36

Click on FORM1 in the Object Navigator:

10.2 Changing The Form Properties Ci i ot fr N m V l ar u adt e B N D Ci o t D t aeT p lk n h om a e a e ti t n y J S O B. lk n h a bs ye c t e u tb e p O c e a Property or Value and double-cc t cc t V l ut id p y O E.Ci o t J M/S lk o yl h a e n lt i l sN N lk n h V O i e e u i sa c e Property and double-cc t cc t t V l ut id p y a i . lko yl o h a e n lt i l sD l k i e e u i sa v

37

10.3 Changing The Window Properties Click on WINDOW1 in the Object Navigator. Click into the window Title Value and type b om Jb D ul lk nh Meu rpr o V l t t g t V l t a e Moi r s os ob -cc o t F . e i e n Poe y r a eo o l h a eo Fl t u ge e u s:

10.4 Creating A List Ci o B O K i t O j t ai t .T e N wMu i eodBok ad e Snl R cr lk n L C 1 n h b c N v a r h e c e e go l-R cr l n N w i e eod t c g Bok bt no t t toolbar become disabled, whilst buttons for other new objects become l u o n h op c t e enabled:

38

Ci o t e Ls bt n nh t l r A oj tae i1 apa o t sr n lk nh N w i u o o t o b . n b ccld Ls per nh c e: c e t t e oa e l t s e e

C ag t N m o t ltoIE LS D a t ltoP si X 0adP si Y 0. hne h a e fh i t FL _ IT. r h i t oio e es g es t n 6 n oio t n 2 C ag t L blo FlLs.C ag L bl t 0.Ci o ay t i t Poe y o m t hneh aet i i hne aeX o 1 lk n n im n h rpr cl n o e e t c e e t u take the cursor out of the Label X Value:

39

10.5 Creating A Field Ci o B O K i t O j t ai t .Ci o t e Fe u o o t t l r A oj t lk n L C 1 n h b cN v a r lk n h N w id bt n n h o b . n b c c e e go c e l t e oa e cld Fe 1 apa o t sr n ae idper nh c e: l l s e e

C ag t N m o t f l t B N MB R. D a t f l t P si X0 ad oio Y hneh a e fh id o J _ U E e ee O r h id o oio g ee t n 6 n P si tn 0.C ag t Wi h o0.C ag t L blo Jb o.C ag t L bl t 0.C ag 5 hneh d t 8 hneh aet N hneh aeX o 1 hne e t e o e t Ma C a c rt D ul lk nh C s Poe y r a eo og t V l t pe : h e x hr t so 8. ob -cc o t ae rpr o V l t t l h a eo U pr ae e i e t u ge e u

40

Repeat the same actions for the following fields: Fe N m D L N i P si X0, oio Y0, ae dl L bl 0, ae id a e MO E _ O wt oio l h t n 6P si t n 7L blMoe , aeX 1L bl Y0 ad aeU pr 7 n C s pe . Fe N m E C ITO i P si X 0 P si Y 0, d 6L blD sL bl id a e D S RP I N wt oio l h t n 6, oio t n 9Wi h 10, ae ec ae t , X0, aeY0, x hr t s3n C s pe . 1L bl 9Ma C a c r2 ad aeU pr ae Fe N m E I L N i P si X 0, oio Y 1L blSr o, ae X 0, id a e S RA _ O wt oio l h t n 6P si t n 10, ae e N L bl 1 L bl 1n C s pe . aeY 10 ad aeU pr Fe N m E T wt P si X 0, oio Y 4Wi h6H i t6L blT x , id a e T X i oio l h t n 6P si t n 10, d 10, e h 0, ae et t g L bl 0, aeY4Ma C a c r00 ad l-Ln re aeX 1L bl 10, x hr t s10n Mu i i Tu ae t e :

10.6 Creating A Button Ci o B O K i t O j t ai t . Ci o t e B t n bt no t t l r A lk n L C 1 n h b c N v a r lk n h N w u o u o n h o b . n c e e go c e t t e oa oj tae u o1 apa o t sr n b ccld B t nper nh c e: e l t s e e

41

D a t bt nt P si X 6 n P si Y 0. C ag t bt nN m t i t r h u o o oio g e t t n 10 ad oio t n 2 hne h u o a e o Ve ,h e t w e Wi ho 6n t L blo Ve d t 0 ad h aet i : t e w

Repeat the same actions for the following buttons: B t n a eR F E H wtP si X0, oio Y1Wi h 7n L blR f s u o N m E R S i oio t h t n 1P si t n 20, d 0 ad aee eh. t r B t n a eS V i P si X0, oio Y1Wi h 7n L blSv u o N m A E wt oio t h t n 8P si t n 20, d 0 ad aeae t . B t n a eE I i P si X5P si Y1Wi h 7n L blE i. u o N m X T wt oio t h t n 10, oio t n 20, d 0 ad aex t t The basic framework for the form has been created, although hidden fields and button triggers now need to be added to give it usable functionality:

42

10.7 Adding Hidden Fields MobiForms uses hidden fields to contain variables for behind the scenes processing in button triggers and calculations. Add the following hidden fields: Fe N m IE N ME wt P si X 0, oio Y 4Wi h0, ae iL bl id a e FL _ A i oio l h t n 6P si t n 20, d 5L blFl , ae X t e 0, aeY4Ma C a c r0 ad ib a e 1L bl 20, x hr t s3n Vs l Fl ae ie s . Fe N m E _ E T wt P si X7P si Y4Wi h 5L blT m L bl id a e T MP T X i oio l h t n 10, oio t n 20, d 0, aee p, ae t X2L bl 4Ma C a c r0 ad ib a e 10, aeY 20, x hr t s3n Vs l Fl ae ie s . 10.8 Adding Button Triggers For the View button add the following Trigger text: :block1.file_name='c:\sdcard\jobs\'; :block1.temp_text=:block1.file_list; :block1.file_name=+:block1.temp_text; :block1.job_number=''; :block1.model_no=''; :block1.description=''; :block1.serial_no=''; :block1.text=''; open_read(:block1.file_name); read(:block1.job_number); read(:block1.model_no); read(:block1.description); read(:block1.serial_no); loop1(10); :block1.temp_text=''; read(:block1.temp_text); :block1.text=+:block1.temp_text; if1(:block1.temp_text!='')then :block1.text=+chr(13); :block1.text=+chr(10); end_if1; end_loop1; close_read; For the Refresh button add the following Trigger text:

43

local_directory('c:\sdcard\jobs',:block1.file_list); For the Save button add the following Trigger text: if1(:block1.job_number='')then stop_message('ERROR! The job number must be entered.'); end_if1; :block1.file_name='c:\sdcard\jobs\'; :block1.file_name=+:block1.job_number; :block1.file_name=+'.txt'; open_write(:block1.file_name); write(:block1.job_number); write(chr(13)); write(chr(10)); write(:block1.model_no); write(chr(13)); write(chr(10)); write(:block1.description); write(chr(13)); write(chr(10)); write(:block1.serial_no); write(chr(13)); write(chr(10)); write(:block1.text); write(chr(13)); write(chr(10)); close_write; :block1.job_number=''; :block1.model_no=''; :block1.description=''; :block1.serial_no=''; :block1.text=''; For the Exit button add the following Trigger text: exit_form; 10.9 Saving The Form From the File menu on the toolbar choose the Save option:

44

Choose a location:

10.10 Running The Form On The PC B fr rni t fr c a a c da o e adt na j s fl r eet t m t t pt e e un g h om r t \scr fl r n h o n e ee : d d e bo e bna o a h h a o d h c e h \sdcard\j s ue i the example above. This folder is named to match future folders used on the c : o sd n b smartphone. From the File menu choose the Run option:

45

The form appears as follows:

Enter the data as follows:

46

10.10.1 The Save Button Press the Save button. The MobiScript behind the scenes checks to see if a Job No has been entered. It bi s pa i nm b pe x gt JbN wt t d et y n sfx giwt x frh fe u d u fe a e y r i n h o o i h i c r ad uf i t i .t o t i l l fi e h e r o in h t el type. It opens the file for writing. It writes each field in turn suffixed with the line feed and carriage return characters. Finally, it closes the file for writing and clears the screen. Afe ae 24 x sol hv apa d nh \sdcard\j sd et y i cld 13.t hu ae per it c l l t d e e : o i c r. b r o 10.10.2 The Exit Button Press the Exit button. This closes the window and stops the application using the simple exit_form; command. 10.10.3 The Refresh Button Re-run the form. Now press the Refresh button. This executes the local_directory command listing the cn n o t \sdcard\j sd et yn the :block1.file_list object as follows: ot t fh c es e : o ic r io b r o t

10.10.4 The View Button Press the View button. This builds up the file name from the chosen file name in the File List, clears the current screen fields and then opens the file for reading. Each line of the file is then read into its appropriate field with a loop to read multiple lines into the long text field. Finally, the file is closed:

In summary, this application can create multiple files and read any at will from a list.

47

10.11 Preparing To Run On A Google Android Smartphone Connect the Google Android smartphone via the USB cable to the PC. On the Google Android smartphone screen pull down the USB icon on the top toolbar to reveal the "USB Connected" notification. Tap on the notification and press the Mount button. The Removable Disk window is displayed on the PC:

Choose "Open folder to view files using Windows Explorer" and press the OK button. This folder is t s a poe da ib o t P a di d From this folder create a child folder called h m r hn / cr v i e n h C s r e : e t s s d sl e v \. b js o . T eal t ap ct nt rno t s a poe h r e ne t \sdcard\j sm sb cagd o nb h plao o u n h m r hn t e r cso c e e i i e t e fe : o ut e hne b it R f s, ae n Ve bt n t r e t da / bo e o t s a poe nh e ehSv ad i u oso e rh / cr j sfl r nh m r hn. e r w t f e s do d e t Change the Refresh button as follows: local_directory('/sdcard/jobs',:block1.file_list); In the Save and the View buttons replace the line: :block1.file_name='c:\sdcard\jobs\'; With: :block1.file_name=''; :block1.file_name=+chr(47); :block1.file_name=+'sdcard'; :block1.file_name=+chr(47); :block1.file_name=+'jobs'; :block1.file_name=+chr(47); This approach with the chr(47) representing the forward slash stops confusion with the mathematical divide symbol which also uses the forward slash. C ag t fr nm t S O B n sv it t fe sob. l U et D p y et hne h om a e o J N D 2 ad ae to h i j nd2 m s h el m n e B e l b f . e o Wizard to deploy the application to the smartphone. 10.12 Deploying The Form To The Google Android Smartphone Section 26.0 describes the MobiForms Deployment Wizard in more detail. In summary, from the MobiForms Developer Deploy menu choose the LNK option. The Install LNK tab is displayed.

48

10.12.1 The Install LNK Tab

Pesh Is lbt n T ii tlt Moiom rn m ad l knh s a poe Por r t ntl u o. h n ash s e a t s s l e b r sut e n ai it m r hn rga F i n e t s m menu. On completion the Install FML tab is displayed. 10.12.2 The Install FML Tab

Pest Is l bt n T i i tl t ap ct nF r h ntl u o. h n as h plao ML fei o t da fl ro t s e a t s sl e i i i n h / cr o e n h l t e s d d e smartphone. 10.13 Running The Form On The Google Android Smartphone Disconnect the smartphone from the PC USB cable before trying the application. Navigate to the Program menu and locate the Mobirung icon at the bottom of the list.

49

Click on the Mobirung icon to start the form as follows:

Note that the version of the MobiForms runtime client on Google Android is 5.05.

50

11.0 Advanced Client Server Application (With The NONE Database Option)
This section describes the creation of an advanced client server application that uses simple ASCII files to store and forward jobs data over a wireless connection. For simplicity it is recommended that it is first run over a Wi-Fi network. This example application will be split into three parts: jobsnodb.fml F r f m pei s et nue a m s r a suc fro fe i t b i c r.Newly om r o r o sco sd s at dt or o j is n h j s d et y vu i e a e b l e o r o c a dj fe o cagdj fe a dpse i t u d et y U dt j sisrm t r t o is r hne o is r eoid n h ot i c r. pa d o fe f ee b l b l e t e r o e b l o h e m b ecet a i i t i c r ada m vdi ot m s r j s d et ydr ga oi ln rv n h i d et y n r oe n h at b i c r ui l i s re e n r o e t e e o r o n refresh operation. jbserver.fml Server form ue t lt o pr80 fre o r us frisrm t u d et yo r o sd o ie n ot 00 o r t e et o fe f h ot i c r, re t sn m e q s l o e r o m e snsn t i c r. ed i o h i d et y t en r o jbclicent.fml Client form based on the jobsnodb.fml to be run on a mobile device. A Synchronize button gets job files from the sre i o h i c r ad ed udt j fe f mt u d et y e rn t i d et y n sns pa d o isr h ot i c r. v t en r o e bl o e r o 11.1 The Client Server Architecture PC Server jobsnodb.fml jbserver.fml PDA Client jbclient.fml

Save c:\sdcard\out\xxxx.txt c:\sdcard\jobs\xxxx.txt

Listen

Refresh client_get_file /sdcard/inxxxx.txt remote_delete View /sdcard/in/xxxx.txt Save /sdcard/out/xxxx.txt

View c:\sdcard\jobs\xxxx.txt

Refresh c:\sdcard\in\xxxx.txt copy_file

Refresh client_send_file delete_file

11.2 The Master Jobs Form T k t bnd. lap ct n n m d y h tlo WI D W1t b om Jb Mat ae h j sob m plao ad oi t ie f N O eo f i i f et o Moi r s os s r F e. T ifr wlacst bn u d et i . h om i cesh i ,j sad ot i c r s s l en o r oe 10.2.1 The Save Button Add the following text to the Save button Trigger before the bottom five lines that clear the fields:

51

:block1.file_name='c:\sdcard\out\'; :block1.file_name=+:block1.job_number; :block1.file_name=+'.txt'; open_write(:block1.file_name); write(:block1.job_number); write(chr(13)); write(chr(10)); write(:block1.model_no); write(chr(13)); write(chr(10)); write(:block1.description); write(chr(13)); write(chr(10)); write(:block1.serial_no); write(chr(13)); write(chr(10)); write(:block1.text); write(chr(13)); write(chr(10)); close_write; 11.2.2 The Refresh Button Modify the following fields: Fe N m IE N ME wt P si X 0, oio Y 4Wi h0, ae iL bl id a e FL _ A i oio l h t n 6P si t n 20, d 3L blFl , ae X t e 0, aeY4Ma C a c r0 ad ib a e 3L bl 20, x hr t s3n Vs l Fl ae ie s . Fe N m E _ E T wt P si X3P si Y4Wi h 3L blT m L bl id a e T MP T X i oio l h t n 10, oio t n 20, d 0, aee p, ae t X5, aeY4Ma C a c r0 ad ib a e 9L bl 20, x hr t s3n Vs l Fl ae ie s . Add the following new field: Fe N m E _ E T i P si X 0P si Y 4Wi h0, ae m 2, id a e T MP T X 2 wt oio l h t n 20, oio t n 20, d 3L bl T p t L bl 6L bl 4Ma C a c r0 ad ib a e aeX 15, aeY 20, x hr t s3n Vs l Fl ae ie s . Add the following text to the Refresh button Trigger before the current line: local_directory('c:\sdcard\in','c:\sdcard\list.txt'); open_read('c:\sdcard\list.txt'); loop1(100); :block1.file_name=''; read(:block1.file_name); if1(:block1.file_name!='')then :block1.temp_text='c:\sdcard\in\'; :block1.temp_text=+:block1.file_name; :block1.temp_text2='c:\sdcard\jobs\'; :block1.temp_text2=+:block1.file_name; copy_file(:block1.temp_text,:block1.temp_text2); end_if1; end_loop1; close_read; 11.3 The Server Form T ifr wlacs t n u d et i .Sa u t Moiom D vl e adc a a h om i cesh i ad ot i c r s t t p h s l e n r oe r e b r s ee pr n r t F o ee fr cld J S R E i fe a ej e e f lwtt fl wn ar u s om ae E V R wt i nm sr rm i h o o i ti t : l B hl b v. h e l g tb e F r N m S R E i D t ae yeN N om a eJ E V R wt a bs T p O E. B h a Wi o N m N O i Wi h4H i t30, ie b om Sre adMeu n w a e WI D W1 wt d 20, e h 0Tt Moi r s e r n d h t g l F v n a e Fl s. Bok a eB O K i T p omBok, ae alu n Whr Cas u l N m L C 1 wt yeF r l B s T b nl ad e l enl. c h c e l e u l Fe N m O T wt P si X 0, oio Y 0, d 0, ae ot L bl 0, id a e P R i oio l h t n 5P si t n 1Wi h 5L blP r, ae X 1 t L bl 0, a T p U E Ma C a c rn Mu i i a e aeY 1D t yeN MB R, x hr t s4 ad l-Ln Fl e ae t e s.

52

Fe N m O id a e C MMA D i P si X 0, oio Y 0, d 1L bl R ci d l N S wt oio h t n 1 P si t n 6Wi h 20, ae ee e t v C m adL bl 0, ae Y 0, a T p H R, xC a c r 00 adMu i o m ns ae X 1L bl 4D t ye C A Ma hr t s 20 n , e ae l-Line t re Tu . B t nN m IT N wt P si X 0, oio Y 2 Wi h0, ae iead u o a e LS E i oio t h tn 1 P si tn 20, d 7 L bl Ls n n t t Trigger: 11.3.1 The Listen Trigger if1(:block1.port='')then stop_message('ERROR! The port must be entered.'); end_if1; open_server(:block1.port); loop1(1000); start_listener(:block1.commands,''); pause(100); end_loop1; close_server; B t n a eS O i P si X0, oio Y2Wi h 7L blSon Ti e u o N m T P wt oio t h t n 8P si t n 20, d 0, aet ad r gr t p g : 11.3.2 The Stop Trigger if1(:block1.port='')then stop_message('ERROR! The port must be entered.'); end_if1; open_client('127.0.0.1',:block1.port); stop_listener; close_client; Button N m X T wtP si X5P si Y2Wi h 7L blSon Ti e a eE I i oio h t n 10, oio t n 20, d 0, aet ad r gr t p g : exit_form; When the form is run it appears as follows:

N t t th t B t n r e t I ades17 .1. T itge ids ndt sn t s p o h t So u oe r o P dr 2.0 h r grs ei e o ed h t e a e p t fs s 0. si g e o command to the previously started listener. This IP address is the standard address that every computer has for its internal TCP/IP loop back adapter. 11.4 The Jobs Client Form T i fr wlacs t da / n da / t d et i o t h om i ces h / cr i ad / cr o i c r s n h s l e s dn s d u r oe esmartphone and uses the B N D stt p t Sa u t Moiom D vl e adl dt B N D om J S O B a i e le t t p h O s m a. r e b r s ee pr n o h J S O B fr , F o a e O cag t nm t C IN adsv i a fenm slnf l C ag t Tt o hne h a e o J LE T n ae t s i a e j cetm hne h ie n e B l b i . . e l WI D W1 o Moiom Jb Ci t C ag t button triggers as follows: N O t b r s os ln . hneh F e e

53

11.4.1 The View Trigger :block1.file_name=''; :block1.file_name=+chr(47); :block1.file_name=+'sdcard'; :block1.file_name=+chr(47); :block1.file_name=+'in'; :block1.file_name=+chr(47); :block1.temp_text=:block1.file_list; :block1.file_name=+:block1.temp_text; :block1.job_number=''; :block1.model_no=''; :block1.description=''; :block1.serial_no=''; :block1.text=''; open_read(:block1.file_name); read(:block1.job_number); read(:block1.model_no); read(:block1.description); read(:block1.serial_no); loop1(10); :block1.temp_text=''; read(:block1.temp_text); :block1.text=+:block1.temp_text; if1(:block1.temp_text!='')then :block1.text=+chr(13); :block1.text=+chr(10); end_if1; end_loop1; close_read; 11.4.2 The Refresh Trigger Note that the IP address 192.168.55.100 in this trigger should be replaced with the actual IP address of the PC running the JBSERVER server form. open_client('192.168.55.100','8000'); remote_directory('c:\sdcard\out','/sdcard/list.txt'); close_client; open_read('/sdcard/list.txt'); loop1(3); :block1.file_name=''; read(:block1.file_name); if1(:block1.file_name!='')then :block1.temp_text='c:\sdcard\out\'; :block1.temp_text=+:block1.file_name; :block1.temp_text2=''; :block1.temp_text2=+chr(47); :block1.temp_text2=+'sdcard'; :block1.temp_text2=+chr(47); :block1.temp_text2=+'in'; :block1.temp_text2=+chr(47); :block1.temp_text2=+:block1.file_name; open_client('192.168.55.100','8000'); client_get_file(:block1.temp_text,:block1.temp_text2); close_client; open_client('192.168.55.100','8000'); remote_delete(:block1.temp_text); close_client; end_if1; end_loop1; close_read; local_directory('/sdcard/in',:block1.file_list);

54

local_directory('/sdcard/out','/sdcard/list.txt'); open_read('/sdcard/list.txt'); loop2(10); :block1.file_name=''; read(:block1.file_name); if2(:block1.file_name!='')then :block1.temp_text=''; :block1.temp_text=+chr(47); :block1.temp_text=+'sdcard'; :block1.temp_text=+chr(47); :block1.temp_text=+'out'; :block1.temp_text=+chr(47); :block1.temp_text=+:block1.file_name; :block1.temp_text2='c:\sdcard\in\'; :block1.temp_text2=+:block1.file_name; open_client('192.168.55.100','8000'); client_send_file(:block1.temp_text,:block1.temp_text2); close_client; delete_file(:block1.temp_text); end_if2; end_loop2; close_read; For wireless access over a mobile phone network the IP address needs to be set to the value that the server is translated to by the gateway router between the local intranet and the internet. The gateway router will have a static translation setting that the network administrator should be able to set up. 11.4.3 The Save Trigger if1(:block1.job_number='')then stop_message('ERROR! The job number must be entered.'); end_if1; :block1.file_name=''; :block1.file_name=+chr(47); :block1.file_name=+'sdcard'; :block1.file_name=+chr(47); :block1.file_name=+'out'; :block1.file_name=+chr(47); :block1.file_name=+:block1.job_number; :block1.file_name=+'.txt'; open_write(:block1.file_name); write(:block1.job_number); write(chr(13)); write(chr(10)); write(:block1.model_no); write(chr(13)); write(chr(10)); write(:block1.description); write(chr(13)); write(chr(10)); write(:block1.serial_no); write(chr(13)); write(chr(10)); write(:block1.text); write(chr(13)); write(chr(10)); close_write; :block1.file_name=''; :block1.file_name=+chr(47); :block1.file_name=+'sdcard'; :block1.file_name=+chr(47); :block1.file_name=+'in';

55

:block1.file_name=+chr(47); :block1.file_name=+:block1.job_number; :block1.file_name=+'.txt'; delete_file(:block1.file_name); :block1.job_number=''; :block1.model_no=''; :block1.description=''; :block1.serial_no=''; :block1.text=''; local_directory('/sdcard/in',:block1.file_list); 11.5 Running The Application Ceta i n nh P dst frh b Mat i t fl wn poe i : r e nc o t C ek p o t J s s rwt h o o i rpre a o e o e o e h e l g ts Name: b Mat J s sr o e Target: \sdcard\m b u. eosob m c : oi n x j nd. l r e b f Start In: \scr c da : d Create an icon on the PC desktop for t b Mat i t fl wn poe i : h J s s rwt h o o i rpre e o e h e l g ts Name: b om Sre Moi r s e r F v Target: \sdcard\m b u. ebe e f l c : oi n x j r rm r e sv . Start In: \scr c da : d U i t Moiom D p y etWi r dp y t cetm fet t G ol A do sg h n e b r s el m n F o z d el h j lnf l i o h og nri a o e bi . l e e d smartphone. Double-clk nh b Mat ek p cn n et dta fl w : i o t J s s rdst i ad n r a so o s c e o e o o e a l

Pesh ae bt n A fe ae 35 x ic a di t b n u d et i , n t r t Sv u o. i cld 24.t s r t n h j s ad ot i c r sad h s e t l l t e e eo r oe e screen is cleared. Double-cc o t b om Sre i n T p 00 i ot P rf l Pes h ie lk n h Moi r s e r c . ye 80n h otid r t Ls n i e F v o t e e. s e t bt no t th lt e o pr00: u o t s rt ie r n ot80 t a e sn

56

N tt th ie u o bcm s i b d u m tay t p g ue f mpes gtgi o h t Ls n bt n eo e d al at acl s pi a srr r i iaa . e a e t t s e o i l o n o sn n With the smartphone connected over a Wi-Fi connection, click on the smartphone Mobirung link in the Por m n ad r sh e eh bt n rga eu n pe t R f s u o: m s e r t

The commands issued by the client are visible on the server:

T ecet R f sbt ngt ar o lt ffe, oi t fe i ot cet / cr/ h ln e eh u o e i r t s e t i o is cp s h is n h ln da i m e s l e e l t e i s dn diret y n l d t ltn t ltt . r sh i u o t r d h fen t f l : c r ad o sh i i o h i im Pe t Ve bt no e t i i o h id o a es t es e s e w t a e l t e es

57

U dtt t t i t pr eN pw r rb m pa h e wt h ha o o e pol . e e x h e s e :

Pesh ae bt n T isvsh dt i ofe 24.ti t da / td r t Sv u o. h ae t a n i 35 x n h / cr o i s e t s e a t l t e s d u rectory, deletes t o fenh da / i c r ad l rt sr n h l i it / cr i d et y n c a h c e. e dl e s dn r o es e e O pes gt e eh bt nt fe nt da / td et y s oi oe t t sre i o n r i h R f s u o h i i h / cr o i c r icp d vro h e rn sn e r t el es du r o e e v t t \sdcard\i d et y n dle ofh s a poe h c e : n i c r ad e t ft m r hn. r o ed e t Pres t e eh bt no t b om Jb Mat T e i i t \sdcard\i d et y s sh R f s u o n h Moi r s os s r h fe n h c e r t e F e. l e : n ic r i r o m vdi ot \sdcard\j sd et y n t ltt ir r hd Fnl , i t 35 x fe oe n h c t e : o i c r ad h i im se e e. i l wt h 24.t i b r o es e fs ay h e t l coe o t lt r sh i u o t r dt fe n t b om Jb Mat c e a hsn n h i pe t Ve bt n o e h i i o h Moi r s os s rsr n s es s e w t a el t e F e e follows:

58

I sm a ,h fe35 x hst vldflc c f m t b om Jb Mat ot n u m r t i 24.t a r ee u i l r h Moi r s os s r t h y e l t a l l re o e F e e b om Jb Ci tad hn en ycrn e bc t t m s r Moi r s os ln n t be snhoi d ako h at . F e e z e e 11.6 A Note On Client Server Applications The above client smartphone application pulls data from the server. This could be turned round with the server application on the smartphone. For this to work the smartphone would need a fixed IP address so that the when files are pulled off, the destination would know each unique device and its identifier. A fixed IP address is not always a supportable option on the smartphone. Quite often wireless network vendors assign a different unique IP address every time a device connects to it.

59

12.0 The HSQLDB CUSTOMER Tutorial


Set up your development PC HSQLDB environment as described in Appendix B. Double click on MobiForms Developer icon in the Programs menu MobiForms option. The following screen is presented: 12.1 Creating A New Form

Choose the File pull-down menu and select the New option:

A new window and block appear. The window width and height are measured in pixels with the defaults set to 240 by 320 the size of a standard PDA screen.

60

Click on FORM1 in the Object Navigator:

12.2 Connecting To The Database Click on the Database Type Property or Value and double-click to cycle the Value until it displays S L B.D ul H Q D ob -click on the Connect String to reveal the text Editor window or type directly in e the Connect String for your database e.g. jdbc:hsqldb:file:\sdcard\testdb (see section 5.8 for more examples) and click out of the field. Note that Appendix B describes the configuration of the HSQLDB database environment required for this tutorial.

61

Choose the File pull-down menu and select the Connect option:

T p t ss mam n sra es L aeh Ps od l k n st s a pei s be st yeh yt d iU e m . ev t as r b n ul sh hs r o l en e e e n a e w a e i v uy :

62

12.3 Applying Google Android Parameters Double click on the form JVM until it toggles to the value of Dalvik. Click on the Size Factor and change it to 1.4. This will enable the form to run in 320x480 pixel mode on the smartphone.

12.4 Applying A Base Table To A block Click on BLOCK1 in the Object Navigator and then double click on the Base Table attribute in the Properties palette to show a list of accessible tables:

63

Highlight the CUSTOMER table press OK to return with the value. 12.5 Adding A New List Item Hover the mouse over the top toolbar New List button and press it. A new list item called LIST1 appears in Window1 and the Object Navigator.

D a LS 1 i t m ueo oio X0 ad oio Y0 a so n n h Poe i plt r IT wt h os t P si g h e t n 7 n P si t n 2 s hw i t rpre a t. e ts ee Update the X and Y attributes manually for finer control. Click on the Name attribute in the Properties pltad ea eh lto CT n t L blo Ct . ob cc o t LsQ e ar u a t n r m t i t IY ad h aet i D ul lk n h i ur ti t ee n es e y e i e t y tb e and type the following query:

64

Press OK to return to the Properties palette. Note that this query is using a subset of data from the same CUSTOMER table for the CITY list. In a real application this list would be most likely be driven from a separate reference table for cities. 12.6 Adding A New Field Click on the BLOCK1 in the Object Navigator and press the New Field button on the top toolbar. Drag t nwf l cld IL 1 o oio X0 ad oio Y0. h e id ae FE D t P si e e l t n 7 n P si t n 5 Double click on the Name attribute to list the columns in the CUSTOMER table:

Click on OK to return with ID into the Name attribute in the Properties palette T p utd i o h . ye C sIn t t e Label attribute. Alter the Width of the ID field to 50. Note that the Database Item attribute has been

65

at acl udt t re,h D t T p ar u t U E adt Ma C a c r u m tay pa d o Tu t a ye ti t o N MB R n h o i l e e a tb e e x hr t s ae ar u t 0. ti t o 1 tb e

For each of the following fields and buttons remember to click on the BLOCK1 block in the Object Navigator to enable the toolbar buttons at the top of the screen. Add another field, double click on the Name, choose the FIRSTNAME column, drag it to Position X 0, oio Y0 ad pa t L blo Fr 7P si t n 8 n udt h aet it e e s. Add another field, double click on the Name, choose the LASTNAME column, drag it to Position X 0, oio Y1 n udtt L blo S ra e. 7P si t n 10 ad pa h aet unm e e Add another field, double click on the Name, choose th S R E cl n da it P si X0, e T E T o m , r to oio u g t n 7 P si Y4 n udtt L blo Sr t oio t n 10 ad pa h aet t e . e e e 12.7 Adding A New Button Pesh N wB t n p o ofh t l r n da t nwbt n o oio X0 ad oio Y r t e u o ot n ft o b ad r h e u o t P si s e t i e oa g e t t n 3 n P si tn 8 U dt t L bl ti t t r n t N m t R V .Pesh N wB t not n 10. pa h ae ar u o Pe ad h a e o P E r t e u o p o e e tb e v e s e t i ofh t l r n da t nwbt nt P si X 2 n P si Y 8 U dt t L bl ft o b ad r h e u o o oio e oa g e t t n 10 ad oio t n 10. pa h ae e e ar u t etad h N m t E T .Fnl , r sh N wB t n p o ofh toolbar and ti t o N x n t a eo N X i l pe t e u o ot n ft tb e e ay s e t i e da t nw bt nt P si X 7 n P si Y 0.U dt t L bl ti t t i r h e u o o oio g e t t n 11 ad oio t n 2 pa h ae ar u o Fn , e e tb e d ae t Wi ho 5 n t N m t I D . lrh d t 8 ad h a eo FN t e t e

66

12.8 Adding A Button Trigger Double click on the Trigger attribute of the Find button, typ xct qe ; i t Ti e wno e eeu _ur n h r gr i w e y e g d and press the OK button to return with the trigger text.

U dt t Ti e t to t Pe bt nt r i sr od adt Ti e t to N x bt n pa h r gre frh r u o o pe o _e r; n h r gre fr et u o e e g x e v t vu c e g x t t et eod . o nx r r; _c 12.9 Block Where Clause Click on BLOCK1 in the Object Navigator and double click on the Where Clause attribute, type the following statement in the Where Clause window and press OK to return with the text:

67

12.10 Saving The Form Click on FORM1 in the Object Navigator and then on the Name attribute in the Properties palette. T p t nwnm o U T adcos t Flpl ye h e a e f C S n hoe h i u -down menu and select the Save option. The e e e l Save dialogue appears with the file name defaulting to CUST.fml. Press the Save button.

12.11 Running The Form Choose the File pull-down menu and select the Run option. The form appears as follows:

68

The City list is automatically populated with a list of cities. To find customers in the chosen city press t f dbt n T ebt ntge rn t xct qe ; s t et n a ur iat acl h i u o. h u o r gr ush eeu _ur te n ad qe s u m tay e n t t i e e y am y o i l run against the CUSTOMER table using the where clause defined in the BLOCK1 properties. T e et n Pe bt n cnb ue t nv a btenr od b fi t et eod ad h N x ad r u os a e sd o ai t e e e rs y in h nx r r; n v t ge w c rg e _c r i sr od s pe o _e r; tatements. vu c

The application also has a default set of pull-down menus at the top to allow record query and navigation. 12.12 Querying Records To query a record the form must be placed in Query Mode. This can be done by choosing the Query pull-down menuadt nt E t ot n T esr nc a adt ur Moe po p i n h h n r p o. h c e l r n h Q e e e e i e es e y d rm ts apne t t wno tlt i i tt m d o oe t n T e sr a fr xm lt e 2 i pedd o h i w ieo n c eh oe f pr i . h ue cn o ea p y %n e d t da e ao e p the Cust Id field. To execute the query Choose the Query pull-down menu followed by the Execute option and one record will be retrieved. 12.13 Exiting The Form To exit the form choose the Action pull-down menu followed by the Exit option. The control should move back to MobiForms Developer. 12.14 Deploying The Form To The Google Android Smartphone Connect the Google Android smartphone to the PC using the USB cable. Deploy the form to the smartphone using the MobiForms Deployment Wizard using in turn the Install LNK tab, the Install FML tab and finally the Install Database tab. Note that the Install Database tab automatically converts

69

t P pt i t cnettn t a og A do cm ab pt o da /s b. R m m e h C a n h oncsi o G ol nri o pt l a f/ cr t t e e br e h e rg e d ie h s de d to disconnect the USB cable from the smartphone before trying the application.

70

13.0 Advanced MobiForms Features For HSQLDB


MobiForms has advanced features that allow fields to be protected from update and disabled protecting the integrity of the data on the mobile device. 13.1 Protecting Fields With The Updateable Attribute The current example form has one basic flaw in that any field can be updated. With the Action pulldown menu and Commit option the data can then be changed permanently. Fields alternatively can be protected from update by double clicking on the field Updateable attribute an stn it l d ei to f s . tg ae This should be done to the ID, FIRSTNAME and LASTNAME fields. 13.2 Validating Duplicates In A Field Whna om ii srMoe ( e et n1.2 iiue lob al t vl a dt t esr e fr sn I e n t d s sco 3 . ts sf t e b o adt a o nue e i 3) u e i e a that a duplicate record has not been entered. In the above advanced example double click on the Validation Query attribute of the ID field. The Validation Query window appears. Type the following statement in the window and press OK to return with the text:

Where there is a match MobiForms provides the Validation Message attribute where the user can type an error message for example as follows:

71

13.3 MobiForms Runtime Modes MobiForms have several running modes that are identified to users on the bottom window tool bar. For Google Android the window tool bar is accessed via the Menu button just below the screen. 13.3.1 Query Mode Query Mode is accessed by choosing the Query menu and then the Enter option. The screen clears and t ur Moe po p apa apne to the window title. The user is then free to type in any h Qe e y d rm t per pedd s database field to construct the required query parameters. The query is executed by the Query menu followed by the Execute option and one or more records will be retrieved. The window title changes back to its default.

13.3.2 Insert Mode To create a new record in a table the form must be cleared by the Block menu followed by the Clear ot n T e i o tl iapne b t srMoe po p D t cnb t e a ncs r. p o. h wn w ie s pedd y h I e i d t e n t d rm t a a e y d s ees y . a p a Finally, data will only be saved in the database when the Action menu is chosen followed by the Save option. The window title changes back to its default.

72

13.3.3 Update Mode A record is updated when the user types into an updateable field. The form will automatically change t pa Moe.T e pa iol svd n h dt ae hn h A t n eu s hsn o o e o U dt d h udt s n ae i t a bs w e t co m n icoe fl w d e e y e a e i l by the Save option. The window title changes back to its default. 13.3.4 Delete Mode The delete mode in MobiForms is not accessible from the window pull-down menu in order to protect from casual unintentional deletes. Delete mode can only be invoked by using the MobiScript e t r od cm adi abt ntge I t sm w ya o e m ds h wno tl i dle e r; o m n n u o r gr n h a e a s t r oe t i w ie s e_ c t i . e h e d t apne wt e tMoe ad f aSv cm le t t nat n pedd i D le d n ai l ae o p t h r sco. h e n es e a i 13.4 Hidden Fields Hidden fields allow control fields to be added to MobiForms to hold temporary variables and to hide fields that do not need to be seen by the user. The current example is unable to populate all of the columns during an insert into the CUSTOMER table as there is no database field for the CITY column. The solution is to create a hidden CITY field which is populated from the CITY list. To avoid confusion the CITY list will need to be renamed first. In the Object Navigator click on the CITY list and change its Name attribute to CITY2. Click on BLOCK1 in the Object Navigator and change the Where Clause as follows:

73

With BLOCK1 highlighted in the Object Navigator, click on the New Field button on the top toolbar ad r o m nay pa it P si X0 ad oio Y4 T eaecn l b m vd n da r aul udt to oio g l e t n 7 n P si t n 20. h l la a o e oe b s t L bl n L bl 4 C ag t L blo i e Ct .D ul cc o t Vs l o ae X 0 ad ae Y 20. hne h ae t Hd n i ob lk n h ib e d y e i e ie ar u t a e. ob click on the Name attribute and choose the DEPTNO from the column list. ti t o Fl D ul tb e s e

A da e bt ncldae wt a i ho 6,hni t r n etbt n s ir d nw u o ae Sv i wd f 5 cag g h Pe ad N x u os i l l t l h t n e v t m ay as follows:

A d h fl wn tge t t ae bt n N tt tpc characters either side of the equals sign d t o o i r gro h Sv u o. o h sae e l gi e t e a are not supported.

74

Run the form, choose the Block pull-down menu followed by the Clear option. The form will now be i IsrMoe T p nt C sI f l a e o m s g sol apa the validation trigger n ne t d. ye 9 i h utd id n r r es e hu per e e, r a d e o m s g sol hv fe. T p 0 i t dt ssol b a acp b vl ,hnFr r r es e hu ae i d ye 5 n e h hu e n cet l a e t r a d r sa i d a e u e it s r N m m t adSr t 1Hg Sr t Fnl o pes gt ae bt nt cags Fe , a e S i n t e i t e . i l n r i h Sv u o h hne d h e h e ay sn e t e will be reflected into the database. 13.5 Colour Palette Each button, field, label, list and window have attributes that describe their font, fill or label colours. The RGB value for any colour can be chosen by doubling clicking on the appropriate attribute to reveal the Colour Palette. To change the Prev button to a green Fill Colour in the CUST example choose your pe r dgenf m t S a hsa o cag t vl R dvl t t G en a eo5 r e e r r h w t e t r hneh a e e a eo 0,h r vl t 25 fr e o e c b e u u e e u ad h Bu vl t aul wtt srlbrit R Bt : n t l a eo 0 m nay i h c l a nh G a e e u l h e o s e b

75

Press the OK button to return with the value. Additionally, change the Next button to blue and the Save button to Red. The window in the Developer should display the chosen colours as follows:

Note that in this first version of MobiForms for Google Android smartphone the changing of button or field background colours is not supported. On saving and running the form, the following should be presented:

76

13.6 Font Chooser Each button, field, label, list have attributes that describe their font type and size. These can be changed by doubling clicking on the appropriate attribute to reveal the Font, Size and Colour window. To change the font on all of the buttons in the CUST example to TimesRoman select this font from the list. To change the size alter the default from 12 to 14, press the return key and click OK to return with the new values.

On saving and running the form the following should be presented:

77

13.7 The Limitations Of The HSQLDB Examples This advanced tutorial has been constrained by the simplicity of the HSQLDB default table structure. It has not been possible to demonstrate the following capabilities, which may be seen in the Oracle or Sybase sections later in this document: Populating a non-database field with a block Post Query trigger. Protecting a non-database field with the enabled attribute. Validating against a reference table.

78

14.0 The Oracle EMPS Tutorial


This tutorial uses the standard Oracle demonstration tables owned by the SCOTT user and requires preferably wireless Wi-Fi access to an Oracle database. Double click on MobiForms Developer icon in the Programs menu MobiForms option. The following screen is presented: 14.1 Creating A New Form

Choose the File pull-down menu and select the New option:

A new window and block appear. The window width and height are measured in pixels with the defaults set to 240 by 320 the size of a standard PDA screen.

79

Click on FORM1 in the Object Navigator:

14.2 Connecting To The Database Double click on the Database Type and cycle it until it has a Value of Oracle Server. Type in the Connect String for your database e.g. jdbc:oracle:thin:@server1:1521:ora92 (see section 5.8 for more examples) and click out of the field. Note that the IP address of the server may have to be used in the connect string in place of the server name, and the tnsnames.ora file on the server may also have to include the explicit IP address of the server rather than the server name. Double click on the JVM and cycle it to the Value of Dalvik. Update the Size Factor to 1.4 to enable it to run on a 320x480 screen.

80

Choose the File pull-down menu and select the Connect option:

Type the username of Scott and the password of Tiger or the equivalent for your Oracle database:

81

14.3 Applying A Base Table To A block Click on BLOCK1 in the Object Navigator and then double click on the Base Table attribute in the Properties palette to show a list of accessible tables:

Highlight the EMP table press OK to return with the value. 14.4 Adding A New List Item Hover the mouse over the top toolbar New List button and press it. A new list item called LIST1 appears in Window1 and the Object Navigator.

82

D a LS 1 i t m ueo oio X0 ad oio Y0 a so n n h Poe i plette. r IT wt h os t P si g h e t n 7 n P si t n 2 s hw i t rpre a e ts Update the X and Y attributes manually for finer control. Click on the Name attribute in the Properties pltad ea eh lto D P N n t L blo D p N D ulcc o t LsQ e a t n r m t i t E T O ad h aet et o. ob lk n h i ur ee n es e e i e t y attribute and type the following query:

Press OK to return to the Properties palette. 14.5 Adding A New Field Click on the BLOCK1 in the Object Navigator and press the New Field button on the top toolbar. Drag t nwf l cld IL 1 o oio X0 ad oio Y0. h e id ae FE D t P si e e l t n 7 n P si t n 5 Double click on the Name attribute to list the columns in the EMP table:

83

Ci o O t r un i E N i o h N m ar u i t Poe i plt T p m N lk n K o e r wt MP O n t a e ti t n h rpre a t. ye E p o c t h t e tb e e ts ee into the Label attribute. Alter the Width of the EMPNO field to 50. Note that the Database Item ar u hs enat acl udt t re,h D t T p ar u t U E adt ti t a be u m tay pa d o Tu t a ye ti t o N MB R n h tb e o i l e e a tb e e Ma C a c rar u t x hr t s ti t o 4. a e tb e

For each of the following fields and buttons remember to click on the BLOCK1 block in the Object Navigator to enable the toolbar buttons at the top of the screen. A dao e f l dul cc o t N m ,hoe h E A d nt rid ob lk n h a ecos t N MEcl n da it P si X0, h e, e i e e o m , r to oio u g t n 7 P si Y0 ad pa t L blo N m oio t n 8 n udt h aet a e. e e Add another field, double click on the Name, choose the HIREDATE column, drag it to Position X 0, oio Y1 n udtt L blo Hr D t . 7P si t n 10 ad pa h aet i a e e e e A dao e f l dul cc o t N m , hoet MG cl n da it P si X 0, d nt r id ob lk n h a e cos h h e, e i e e R o m , r to oio u g t n 7 P si Y4 n udtt L blo Maae . lrh wd t 50. oio t n 10 ad pa h aet ngr At t i ho e e e e t

84

A dao e f l bth t e i lcc o t N m ,ye MN ME i ot f l ad r it d nt rid u t si s g lk n h a et A n h id n da to h e, i m ne i e p t ee g P si X 2 n P si Y 4 D le h L bl N t t th f l ia o-database field oio t n 10 ad oio t n 10. e t t ae o h t sid s nn e e . e a i e wtt D t ae t ar u sto Fl i h a bs I m ti t et a e. h e a e tb e s 14.6 Adding A New Button Pesh N wB t n p o ofh t l r n da t nwbt n o oio X0 ad oio Y r t e u o ot n ft o b ad r h e u o t P si s e t i e oa g e t t n 3 n P si tn 8 U dt t L bl ti t t r n t N m t R V .Pesh N wB t not n 10. pa h ae ar u o Pe ad h a e o P E r t e u o p o e e tb e v e s e t i off the toolbar and drag th nwbt nt P si X 2 n P si Y 8 U dt t L bl e e u o o oio t t n 10 ad oio t n 10. pa h ae e e ar u t etad h N m t E T .Fnl , r sh N wB t n p o ofh t l r n ti t o N x n t a eo N X i l pe t e u o ot n ft o b ad tb e e ay s e t i e oa da t nw bt nt P si X 7 n P si Y 0.U dt t L bl ti t t i r h e u o o oio g e t t n 11 ad oio t n 2 pa h ae ar u o Fn , e e tb e d ae t Wi ho 5 n t N m t I D . lrh d t 8 ad h a eo FN t e t e

14.7 Adding A Button Trigger D ul cc o t Ti e ar u o t Fn bt n t e eeu _ur; i t Ti e wno ob lk n h r gr ti t fh i u o,y xct qe n h r gr i w e i e g tb e e d t p e y e g d and press the OK button to return with the trigger text.

85

U dt t Ti e t to t Pe bt nt r i sr od adt Ti e t to N x bt n pa h r gre frh r u o o pe o _e r; n h r gre fr et u o e e g x e v t vu c e g x t t et eod . o nx r r; _c 14.8 Block Post Query Trigger Click on BLOCK1 in the Object Navigator and double click on the Post Query attribute, type the following query in the Post Query window and press OK to return with the trigger text:

14.9 Block Where Clause Click on BLOCK1 in the Object Navigator and double click on the Where Clause attribute, type the following statement in the Where Clause window and press OK to return with the text:

14.10 Saving The Form Click on FORM1 in the Object Navigator and then on the Name attribute in the Properties palette. T p t nwnm o MP n cos t Flpl ye h e a e f E S ad hoeh i u -down menu and select the Save option. The e e e l Save dialogue appears with the file name defaulting to EMPS.fml. Press the Save button.

86

14.11 Running The Form Choose the File pull-down menu and select the Run option. The form appears as follows:

The Dept No list is automatically populated with a list of departments. To find employees in the coe dpr et r sh f d u o.T e u o tge rn t xct qe ;s t etn a hsn ea m n pe t i bt n h bt n r grush eeu _ur te n ad t s en t t i e e y am query is automatically run against the EMP employees table using the where clause defined in the BLOCK1 properties. T e et n Pe bt n cnb ue t nv a btenr od b fi t et eod ad h N x ad r u os a e sd o ai t e e e rs y in h nx r r; n v t ge w c rg e _c r i sr od s t et N tt tn r lLt(e i 4 ad . t df lJ B di r pe o _e r; te n . o h i O a e i vro . n 5 )h e u D C r e v u c am s e a c e sn 0 0 e at v does not support a scrollable cursor, which means that the cursor behind the scenes cannot be made to scroll backwards and hence the Prev button will not work in for Oracle Lite. The Oracle Server driver does support scrollable cursors.

87

The application also has a default set of pull-down menus at the top to allow record query and navigation. 14.12 Querying Records To query a record the form must be placed in Query Mode. This can be done by choosing the Query m n adt nt E t ot n T e c e c a adt ur Moe prompt is appended to the eu n h h n r p o. h sr n l r n h Q e e e e i e es e y d wno tl t i i t t m d o oe t n T e sr a fr xm l t e 7% nt E pN i w ie o n c e h oe f pr i . h ue cn o ea p y 7 i h m o d t da e ao e p e field. To execute the query Choose the Query menu followed by the Execute option and one record will be retrieved. 14.13 Exiting The Form To exit the form choose the Action menu followed by the Exit option. The control should move back to MobiForms Developer. 14.14 Deploying The Form Section 18.0 describes how to use the MobiForms Deployment Wizard to automatically configure and install MobiForms on a Mobile Device. The Deployment Wizard is the recommended approach.

88

15.0 Advanced MobiForms Features For Oracle


MobiForms has advanced features that allow fields to be protected from update and disabled protecting the integrity of the data on the mobile device. 15.1 Protecting Fields With The Updateable Attribute The current example form has one basic flaw in that any field can be updated. With the Action menu and Commit option the data can then be changed permanently. Fields alternatively can be protected f m udt b dul cci o t f l U dt b ar u adstn it l T isol r pa y ob lk g n h id pa al ti t n ei to f s . h hu o e e i n ee e e tb e tg ae s d be done to the EMPNO, ENAME and HIREDATE fields. 15.2 Protecting Fields With The Enabled Attribute The current example form has a non-database field called MNAME. There is no advantage to be achieved by allowing the cursor to navigate into this field. This field can be disabled by double cci o t E al ar u adstn it l T ioe r e t U dt ble attribute and lk g n h nb d ti t n ei to f s . h vri sh pa a i n e e tb e tg ae s d e e stops the user being able to navigate or update it. Non-entereable fields show as grey text on a white background. The following screen shot shows the EMPS form with the suggested changed from above:

15.3 Validating Duplicates In A Field Whna om ii srMoe ( e et n1.2 iiue lob al t vl a dt t esr e fr sn I e n t d s sco 5 . ts sf t e b o adt a o nue e i 5) u e i e a that a duplicate record has not been entered. In the above advanced example double click on the Validation Query attribute of the EMPNO field. The Validation Query window appears. Type the following statement in the window and press OK to return with the text:

89

Where there is a match MobiForms provides the Validation Message attribute where the user can type an error message for example as follows:

15.4 Validating Against A Reference Table Whna om ii srMoe iiue lob alt vl a dtet e aa so e r e ne e fr sn I e n t dts sf t e b o adt a n r gi t t re r c u e i e a e d n h fe tables. In the above advanced example double click on the Validation Query attribute of the MGR field. The Validation Query window appears. Type the following statement in the window and press OK to return with the text:

90

T e s o t i s s t etee e t l i o t vl ao cui a e o m s g t fe h ue fh m n te n r r sh o c fh adt n as g n r r es e o i e u am vs e g e i i n r a r when a match is not found. The DUAL table is a special system table with one column that all Oracle databases contain. Where there is not a match the MobiForms Validation Message attribute can be set as follows:

15.5 MobiForms Runtime Modes MobiForms have several running modes that are identified to users on the window title bar. 15.5.1 Query Mode Query Mode is accessed by choosing the Query menu and then the Enter option. The screen clears and t ur Moe po p apa apne t t wno tl T e srshen free to type in any h Qe e y d rm t per pedd o h i w ie h ue it s e d t. database field to construct the required query parameters. The query is executed by the Query menu followed by the Execute option and one or more records will be retrieved. The window title changes back to its default.

91

15.5.2 Insert Mode To create a new record in a table the form must be cleared by the Block menu followed by the Clear ot n T e i o tl iapne b t srMoe po p D t cnb t e a ncs r. p o. h wn w ie s pedd y h I e i d t e n t d rm t a a e y d s ees y . a p a Finally, data will only be saved in the database when the Action menu is chosen followed by the Save option. The window title changes back to its default.

Note that this example will not allow a record to be saved because there is no database field to represent the mandatory DEPTNO column in the EMPS table. Section 15.6 resolves this problem. 15.5.3 Update Mode A record is updated when the user types into an updateable field. The form will automatically change t pa Moe.T e pa iol svd n h dt ae hn h A t n eu s o U dt d h udt s n ae i t a bs w e t co m n ichosen followed e e y e a e i by the Save option. The window title changes back to its default. 15.5.4 Delete Mode The delete mode in MobiForms is not accessible from the window pull-down menu in order to protect from casual unintentional deletes. Delete mode can only be invoked by using the MobiScript e t r od cm adi abt ntge I t sm w ya o e m ds h wno tl i dle e r; o m n n u o r gr n h a e a s t r oe t i w ie s e_ c t i . e h e d t apne wt e tMoe ad f aSv cm le t t nat n pedd i D le d n ai l ae o p t h r sco. h e n es e a i 15.6 Hidden Fields Hidden fields allow control fields to be added to MobiForms to hold temporary variables and to hide fields that do not need to be seen by the user.

92

The current example will not allow inserts into the EMP table as there is no database field for the DEPTNO column. The solution is to create a hidden DEPTNO field which is populated from the DEPTNO list. To avoid confusion the DEPTNO list will need to be renamed first. In the Object Navigator click on the DEPTNO list and change its Name attribute to DEPTNO2. Click on BLOCK1 in the Object Navigator and change the Where Clause as follows:

With BLOCK1 highlighted in the Object Navigator, click on the New Field button on the top toolbar ad r o m nay pa it P si X0 ad oio Y4 T eaecn l b m vd n da r aul udt to oio g l e t n 7 n P si t n 25. h l la a o e oe b s t L bl 0 adL bl 4 C ag t L blo i e D D ulcc o t Vs l o ae X 1 n aeY 25. hneh aet Hd n N . ob lk n h ib e d e i e ie ar u t a e. ob cc o t N m ar u ad hoeh D P N f mt cl ni. ti t o Fl D ul lk nh a e ti t n cos t E T O r h o m lt tb e s e i e tb e e o e u s

A da e bt ncldae wt a i ho 6,hni t r n etbt n s ir d nw u o ae Sv i wd f 5 cag g h Pe ad N x u os i l l t l h t n e v t m ay as follows:

93

A d h fl wn tge t t ae bt n N tt tpc ca c rehri o t euls n d t o o i r gro h Sv u o. o h sae hr t s i e s e fh qa i e l gi e t e a ae t d e sg are not supported.

Run the form, choose the Block menu followed by the Clear option. The form will now be in Insert Moe T p 72 i t E p o id a e o m s g sol apa validation trigger error d. ye 78n h m N f l n r r es e hu per the e e, r a d m s g sol hv fe.T p 73 i t dt s hu b a acp b vl ,hnt N m es e hu ae i d ye 78 n e h sol e n cet l a e t h a e a d r sa i d ae u e e MIH adHr D t 2 2 99. Fnl o pes gt ae bt nt cags i b S T n i a 1/ / 9 i l n r i h Sv u o h hne wl e e e 11 ay sn e t e l reflected into the database. 15.7 Colour Palette Each button, field, label, list and window have attributes that describe their font, fill or label colours. The RGB value for any colour can be chosen by doubling clicking on the appropriate attribute to reveal the Colour Palette. To change the Prev button to a green Fill Colour in the EMPS example choose your pe r dgenf m t S a hsa o cag t vl R dvl t t G en a eo5 r e e r r h w t e t r hneh a e e a eo 0,h r vl t 25 fr e o e c b e u u e e u ad h Bu vl t aul wtt srlbrit R Bt : n t l a eo 0 m nay i h c l a nh G a e e u l h e o s e b

94

Press the OK button to return with the value. Additionally, change the Next button to blue and the Save button to Red. Note that in this first version of MobiForms for Google Android the changing of button and field background colours is not supported. The window in the Developer should display the chosen colours as follows:

95

On saving and running the form, the following should be presented:

15.8 Font Chooser Each button, field, label, list have attributes that describe their font type and size. These can be changed by doubling clicking on the appropriate attribute to reveal the Font, Size and Colour window. To change the font on all of the buttons in the EMPS example to TimesRoman select this font from the list. To change the size alter the default from 12 to 14, press the return key and click OK to return with the new values.

96

On saving and running the form the following should be presented:

97

16.0 The SQL Server EMPS Tutorial


SQL Server must be configured to accept TCP/IP connections via JDBC and contain the necessary demo tables required in this tutorial. Check that your SQL Server environment meets these requirements and install the demo tables as described in Appendix C. This tutorial is designed to run over a preferably a wireless Wi-Fi connection. Double click on MobiForms Developer icon in the Programs menu MobiForms option. The following screen is presented: 16.1 Creating A New Form

Choose the File pull-down menu and select the New option:

A new window and block appear. The window width and height are measured in pixels with the defaults set to 240 by 320 the size of a standard PDA screen.

98

Click on FORM1 in the Object Navigator:

16.2 Connecting To The Database D ul cc o t D t ae ye ti t ut t Q Sre ot nid p yd T p i t ob lk n h a bs T p ar u n lh S L e r p o s i l e. ye n h e i e a tb e i e v i sa e Connect String for your database e.g. //192.168.0.23:1030/master (see section 5.8 for more examples) and click out of the field. The Connect String should contain the IP address of the server running SQL Server. Double click on the JVM until it toggles to the Value of Dalvik. Enter the Size Factor or 1.4 appropriate for a Google Android smartphone screen size of 320x480.

99

Choose the File pull-down menu and select the Connect option:

Type the SQL Server username and Password:

100

16.3 Applying A Base Table To A block Click on BLOCK1 in the Object Navigator and then double click on the Base Table attribute in the Properties palette to show a list of accessible tables:

Highlight the EMP table press OK to return with the value. 16.4 Adding A New List Item Hover the mouse over the top toolbar New List button and press it. A new list item called LIST1 appears in Window1 and the Object Navigator.

101

D a LS 1 i t m ueo oio X0 ad oio Y0 a so n n h Poe i plt r IT wt h os t P si g h e t n 7 n P si t n 2 s hw i t rpre a t. e ts ee Update the X and Y attributes manually for finer control. Click on the Name attribute in the Properties pltad ea eh lto D P N n t L blo D p N D ulcc o t LsQ e a t n r m t i t E T O ad h aet et o. ob lk n h i ur ee n es e e i e t y attribute and type the following query:

Press OK to return to the Properties palette. 16.5 Adding A New Field Click on the BLOCK1 in the Object Navigator and press the New Field button on the top toolbar. Drag t nwf l cld IL 1 o oio X0 ad oio Y0. h e id ae FE D t P si e e l t n 7 n P si t n 5 Double click on the Name attribute to list the columns in the EMP table:

102

Click on OK to return with EMPNO into th N m ar u i t Poe i plt T p m N e a e ti t n h rpre a t. ye E p o tb e e ts ee into the Label attribute. Alter the Width of the EMPNO field to 50. Note that the Database Item ar u hs enat acl udt t re,h D t T p ar u t U E adt ti t a be u m tay pa d o Tu t a ye ti t o N MB R n h tb e o i l e e a tb e e Max hr t s ti tt 0. C a c rar u o 1 a e tb e

For each of the following fields and buttons remember to click on the BLOCK1 block in the Object Navigator to enable the toolbar buttons at the top of the screen. Add another field, double click on the Name, choose the EN MEcl n da it P si X0, A o m , r to oio u g t n 7 P si Y0 ad pa t L blo N m oio t n 8 n udt h aet a e. e e Add another field, double click on the Name, choose the HIREDATE column, drag it to Position X 0, oio Y1 n udtt L blo Hr D t . 7P si t n 10 ad pa h aet i a e e e e Add another f l dul cc o t N m , hoet MG cl n da it P si X 0, id ob lk n h a e cos h e, e i e e R o m , r to oio u g t n 7 P si Y4 n udtt L blo Maae . lrh wd t 5. oio t n 10 ad pa h aet ngr At t i ho 0 e e e e t

103

A dao e f l bth t e i lcc o t N m ,ye MN ME i ot f l ad r it to d nt rid u t si s g lk n h a et A n h id n da h e, i m ne i e p t ee g P si X 2 n P si Y 4 D le h L bl N t t th f l ia o-database field oio t n 10 ad oio t n 10. e t t ae o h t sid s nn e e . e a i e wtt D t ae t ar u sto Fl i h a bs I m ti t et a e. h e a e tb e s 16.6 Adding A New Button Press the New Button option off the toolbar and drag the new button to P si X0 ad oio Y oio t n 3 n P si tn 8 U dt t L bl ti t t r n t N m t R V .Pesh N wB t not n 10. pa h ae ar u o Pe ad h a e o P E r t e u o p o e e tb e v e s e t i ofh t l r n da t nwbt nt P si X 2 n P si Y 8 U dt t L bl ft o b ad r h e u o o oio e oa g e t t n 10 ad oio t n 10. pa h ae e e ar u t etad h N m t E T .Fnl , r sh N wB t n p o ofh t l r n ti t o N x n t a eo N X i l pe t e u o ot n ft o b ad tb e e ay s e t i e oa da t nw bt nt P si X 7 n P si Y 0.U dt t L bl ti t t i r h e u o o oio g e t t n 11 ad oio t n 2 pa h ae ar u o Fn , e e tb e d ae t Wi ho 5 n t N m t I D . lrh d t 8 ad h a eo FN t e t e

16.7 Adding A Button Trigger D ul cc o t Ti e ar u o t Fn bt n t e eeu _ur; i t Ti e wno ob lk n h r gr ti t fh i u o,y xct qe n h r gr i w e i e g tb e e d t p e y e g d and press the OK button to return with the trigger text.

104

U dt t Ti e t to t Pe bt nt r i sr od adt Ti e t to Next button pa h r gre frh r u o o pe o _e r; n h r gre fr e e g x e v t vu c e g x t et eod . o nx r r; _c 16.8 Block Post Query Trigger Click on BLOCK1 in the Object Navigator and double click on the Post Query attribute, type the following query in the Post Query window and press OK to return with the trigger text:

16.9 Block Where Clause Click on BLOCK1 in the Object Navigator and double click on the Where Clause attribute, type the following statement in the Where Clause window and press OK to return with the text:

16.10 Saving The Form Click on FORM1 in the Object Navigator and then on the Name attribute in the Properties palette. T p t nwnm o MP n cos t Flpl ye h e a e f E S ad hoeh i u -down menu and select the Save option. The e e e l Save dialogue appears with the file name defaulting to EMPS.fml. Press the Save button.

105

16.11 Running The Form Choose the File pull-down menu and select the Run option. The form appears as follows:

The Dept No list is automatically populated with a list of departments. To find employees in the chosen department press the find button. T e u o tge rn t xct qe ;s t etn a h bt n r grush eeu _ur te n ad t i e e y am query is automatically run against the EMP employees table using the where clause defined in the BLOCK1 properties. The Next and Prev buttons can be used to navigate between records by firing the nx r od ad et e r; n _c r i sr od s t et pe o _e r; te n . v u c am s

106

The application also has a default set of pull-down menus at the top to allow record query and navigation. 16.12 Querying Records To query a record the form must be placed in Query Mode. This can be done by choosing the Query m n adt nt E t ot n T e c e c a adt ur Moe po p iapne t t eu n h h n r p o. h sr n l r n h Q e e e e i e es e y d rm ts pedd o h e wno tl t i i t t m d o oe t n T e sr a fr xm l t e 7% nt E pN i w ie o n c e h oe f pr i . h ue cn o ea p y 7 i h m o d t da e ao e p e field. To execute the query Choose the Query menu followed by the Execute option and one record will be retrieved. 16.13 Exiting The Form To exit the form choose the Action menu followed by the Exit option. The control should move back to MobiForms Developer. 16.14 Deploying The Form Section 18.0 describes how to use the MobiForms Deployment Wizard to automatically configure and install MobiForms on a Mobile Device. The Deployment Wizard is the recommended approach.

107

17.0 Advanced MobiForms Features For SQL Server


MobiForms has advanced features that allow fields to be protected from update and disabled protecting the integrity of the data on the mobile device. 17.1 Protecting Fields With The Updateable Attribute The current example form has one basic flaw in that any field can be updated. With the Action menu and Commit option the data can then be changed permanently. Fields alternatively can be protected f m udt b dul cci o t f l U dt b ar u adstn it l T isol r pa y ob lk g n h id pa al ti t n ei to f s . h hu o e e i n ee e e tb e tg ae s d be done to the EMPNO, ENAME and HIREDATE fields. 17.2 Protecting Fields With The Enabled Attribute The current example form has a non-database field called MNAME. There is no advantage to be achieved by allowing the cursor to navigate into this field. This field can be disabled by double cci o t E al ar u adstn it l T ioe r e t U dt b ar u ad lk g n h nb d ti t n ei to f s . h vri sh pa al ti t n i n e e tb e tg ae s d e e e tb e stops the user being able to navigate or update it. Non-entereable fields show as grey text on a white background. The following screen shot shows the EMPS form with the suggested changed from above:

17.3 Validating Duplicates In A Field Whna om ii srMoe ( e et n1.2 iiue lob al t vl a dt t esr e fr sn I e n t d s sco 7 . ts sf t e b o adt a o nue e i 5) u e i e a that a duplicate record has not been entered. In the above advanced example double click on the Validation Query attribute of the EMPNO field. The Validation Query window appears. Type the following statement in the window and press OK to return with the text:

108

Where there is a match MobiForms provides the Validation Message attribute where the user can type an error message for example as follows:

17.4 Validating Against A Reference Table Whna om ii srMoe iiue lob alt vl a dtet e aa so e r erence e fr sn I e n t dts sf t e b o adt a n r gi t t re u e i e a ed n h f tables. In the above advanced example double click on the Validation Query attribute of the MGR field. The Validation Query window appears. Type the following statement in the window and press OK to return with the text:

109

T e s o t o eis s t etee e t l i o t vl ao cui a e o m s g t h ue fh nt x t te n r r sh o c fh adt n as g n r r es e o e s a m vs e g e i i n r a fe hn m t inton.E a p so o e dt ae i t s aul s t i s s t et i w e a a h s o fud xm l fr t r a bssn h m naueh m n te n r c e h a i e u am to achieve the same result, however, this is not supported in SQL Server. The DUMMY table is a special table where we can guarantee that only one record will exist. Where there is not a match the MobiForms Validation Message attribute can be set as follows:

17.5 MobiForms Runtime Modes MobiForms have several running modes that are identified to users on the window title bar. 17.5.1 Query Mode Query Mode is accessed by choosing the Query menu and then the Enter option. The screen clears and t ur Moe po p apa apne t t wno tl T e srshn free to type in any h Qe e y d rm t per pedd o h i w ie h ue it s e d t. e database field to construct the required query parameters. The query is executed by the Query menu followed by the Execute option and one or more records will be retrieved. The window title changes back to its default.

110

17.5.2 Insert Mode To create a new record in a table the form must be cleared by the Block menu followed by the Clear ot n T e i o tl iapne b t srMoe po p D t cnb t e a ncs r. p o. h wn w ie s pedd y h I e i d t e n t d rm t a a e y d s ees y . a p a Finally, data will only be saved in the database when the Action menu is chosen followed by the Save option. The window title changes back to its default.

Note that this example will not allow a record to be saved because there is no database field to represent the mandatory DEPTNO column in the EMPS table. Section 17.6 resolves this problem. 17.5.3 Update Mode A record is updated when the user types into an updateable field. The form will automatically change t pa Moe.T e pa iol svd n h dt ae hn h A t n eu s hosen followed o U dt d h udt s n ae i t a bs w e t co m n ic e e y e a e i by the Save option. The window title changes back to its default. 17.5.4 Delete Mode The delete mode in MobiForms is not accessible from the window pull-down menu in order to protect from casual unintentional deletes. Delete mode can only be invoked by using the MobiScript e t r od cm adi abt ntge I t sm w ya o e m ds h wno tl i dle e r; o m n n u o r gr n h a e a s t r oe t i w ie s e_ c t i . e h e d t apne wt e tMoe ad f aSv cm le t t nat n pedd i D le d n ai l ae o p t h r sco. h e n es e a i 17.6 Hidden Fields Hidden fields allow control fields to be added to MobiForms to hold temporary variables and to hide fields that do not need to be seen by the user.

111

The current example will not allow inserts into the EMP table as there is no database field for the DEPTNO column. The solution is to create a hidden DEPTNO field which is populated from the DEPTNO list. To avoid confusion the DEPTNO list will need to be renamed first. In the Object Navigator click on the DEPTNO list and change its Name attribute to DEPTNO2. Click on BLOCK1 in the Object Navigator and change the Where Clause as follows:

With BLOCK1 highlighted in the Object Navigator, click on the New Field button on the top toolbar ad r o m nay pa it P si X0 ad oio Y4 T eaecn l b m vd n da r aul udt to oio g l e t n 7 n P si t n 20. h l la a o e oe b s toL bl 0 adL bl 4 C ag t L blo i e D D ulcc o t Vs l ae X 1 n aeY 20. hneh aet Hd n N . ob lk n h ib e d e i e ie ar u t a e. ob cc o t N m ar u ad hoeh D P N f mt cl ni. ti t o Fl D ul lk nh a e ti t n cos t E T O r h o m lt tb e s e i e tb e e o e u s

A da e bt ncldae wt a i ho 6,hni t r n etbt n s ir d nw u o ae Sv i wd f 5 cag g h Pe ad N x u os i l l t l h t n e v t m ay as follows:

112

A d h fl wn tge t t ae bt n N tt tpc ca c rehri o t euls n d t o o i r gro h Sv u o. o h sae hr t s i e s e fh qa i e l gi e t e a ae t d e sg are not supported.

Run the form, choose the Block pull-down menu followed by the Clear option. The form will now be i IsrMoe T p 72 i t E pN f l a e o m s g sol apa the validation n ne t d. ye 78 n h m o id n r r es e hu per e e, r a d tge e o m s g sol hv fe.T p 73 i t dt s hu b a acp b vl ,hn r gr r r es e hu ae i d ye 78n e h sol e n cet l a et i r a d r sa i d ae u e t N m MIH adHr D t 2 2 99.Fnl o pes gt ae bt nt cags h a e S T n i a 1/ / 9 i l n r i h Sv u o h hne e e e 11 ay sn e t e will be reflected into the database. 17.7 Colour Palette Each button, field, label, list and window have attributes that describe their font, fill or label colours. The RGB value for any colour can be chosen by doubling clicking on the appropriate attribute to reveal the Colour Palette. To change the Prev button to a green Fill Colour in the EMPS example choose your preferred green from the Swatches tab or change the value Red val t t G en a eo5 u o 0,h r vl t 25 e e e u ad h Bu vl t aul wtt srlbrit R Bt : n t l a eo 0 m nay i h c l a nh G a e e u l h e o s e b

113

Press the OK button to return with the value. Additionally, change the Next button to blue and the Save button to Red. Note that in this first version of MobiForms for Google Android the changing of button and field background colours is not supported. The window in the Developer should display the chosen colours as follows:

114

On saving and running the form, the following should be presented:

17.8 Font Chooser Each button, field, label, list have attributes that describe their font type and size. These can be changed by doubling clicking on the appropriate attribute to reveal the Font, Size and Colour window. To change the font on all of the buttons in the EMPS example to TimesRoman select this font from the list. To change the size alter the default from 12 to 14, press the return key and click OK to return with the new values.

115

On saving and running the form the following should be presented:

116

18.0 Installing MobiForms On A Google Android Smartphone Using The Deployment Wizard
This section describes the use of the Deployment Wizard pull-down menu on the MobiForms Developer tool bar. The Deployment Wizard automatically configures and installs a MobiForms application on a mobile device. This option is enabled when the form attribute for Default Device is set to Windows Mobile, Pocket PC/CE or Google Android The Deployment Wizard consists of four tabbed pages each of which can be accessed as an option from the Deploy pull-down menu. Each option can be run sequentially or independently according to the need. It may be necessary, for example to run the third option which copies over the MobiForms application FML file many times, as an application is developed and tested. For a brand new installation all four options may need to be run. For Google Android the first option is always disabled as the Google Android smartphone platform includes the embedded Dalvik JVM. For devices other than Google Android, before a brand new installation can be done the user must download a suitable JVM (Java Virtual Machine. MobiForms has been certified with the following JVMs for Windows Mobile and Pocket PC/CE, most of which are free to download: Sun phoneME Mysaifu IBM J9 5.X (WebSphere Everyplace Micro Environment) NSI CrEme (PersonalJava Edition) Esmertec Jeode/JBed 18.1 The JVM Option For platforms other than Google Android this shows the JVM installation tab of the Deployment Wizard. From here the user selects the location of the previously downloaded mobile JVM installation file. The Location field initially appears blank:

Press the Browse button to select the location of the downloaded mobile JVM installation file. The following examples show the dialogues for IBM J9 5.X:

117

On pressing the Open button the file name is returned to the Location field:

On pressing the Install button a check is made for the presence of a mobile device connected via the USB cable. Where the check fails the following message is displayed:

Where the check succeeds the JVM file is copied over to the mobile device and the following message is displayed on completion:

Note that for the IBM J9 JVM version 6.1 a CAB file is not supplied. 18.2 The LNK Option This shows the LNK installation tab of the Deployment Wizard. From here the user selects the name of the previously installed JVM on the mobile device from a list matching the one above. For Google Android a field with one value of Google Android is displayed rather than a list.

118

N t t th d l u i l e a hc bxetl c d cnet a ? T icekbxeal o h t s io e n u s cek o n td I l e onc dt h hc o nb s e a i ag cd ie n u a s e the username, password and connect string to be included in the LNK file and stops a connect window appearing with the application. Care should be taken to make sure that the resultant LNK file is not larger than 255 bytes. On pressing the Install button a check is made for the presence of a mobile device connected via the USB cable. Where the check fails the following message is displayed:

Where the check succeeds the MobiForms runtime environment files and shortcut LNK files are copied over to the mobile device and the following message is displayed on completion:

18.3 The FML Option This shows the FML installation tab of the Deployment Wizard. From here the user selects the name of the previously installed JVM on the mobile device from a list matching the one above. For Google Android a field with one value of Google Android is displayed rather than a list.

119

On pressing the Install button a check is made for the presence of a mobile device connected via the USB cable. Where the check fails the following message is displayed:

Where the check succeeds the MobiForms application FML file is copied over to the mobile device. If the Install Database tab is disabled the final message is displayed on completion:

If the Install Database tab is enabled the following message is displayed on completion:

18.4 The Database Option This shows the database installation tab of the Deployment Wizard and is only enabled for the HSQLDB database option. The final location of the database on the device is displayed. The location idr e f m t l ru et fh dt ae oncsi .Im snot contain a drive letter or s e vd r h fe a m n o t a bs cnettn t ut i o e i: g e a rg saeca c r U e pc hr t s s \hsqldb\t t a e t n \hsqldb\t t A o t ueo r av pt ae. e d r hrh c sb t a : e d . vi h s fe t e a s sb d e li h l e. s b. i et k \t d

120

On pressing the Install button a check is made for the presence of a mobile device connected via the USB cable. Where the check fails the following message is displayed:

Where the check succeeds the database files are copied over to the mobile device and the final message is displayed on completion:

121

19.0 Google Android Camera Tutorial


The aim of this tutorial is to build a simple Google Andorid camera app. Double click on the MobiForms Developer icon in the Programs menu MobiForms option. The following screen is presented: 19.1 Creating A New Form Choose the File pull-down menu and select the New option:

A new window and block appear. The window width and height are measured in pixels with the defaults set to 240 by 320 the size of a standard PDA screen. Click on FORM1 in the Object Navigator:

122

Click on the form Name attribute and updtit A R D ulcc o t D t ae ye a to C ME A . ob lk nh a bs T p e e i e a ar u ut t O E ot ns i l e. ob cc o t J M ar u ut t a i ti t n lh N N p o id p yd D ul lk nh V ti t n lh D l k tb e i e i sa e i e tb e i e v option is displayed:

19.2 Configuring The Window Size Click on WINDOW1 in the Object Navigator. Click on the Width attribute and update to 320 and the H i tti tt 40 U dtt Tt ar u t a e D ulcc o t Meu ti t e har u o 8. pa h ie ti t o C m r . ob lk nh g tb e e e l tb e a e i e n ar u tb e ad eit a e: n stto Fl s

19.3 Adding A Field Click on BLOCK1 in the Object Navigator. Click on the New Field button on the top toolbar to display a new field. Drag the field to Position x = 80 and Position Y = 20. Update the Name to FL _ A ,h Wi ht 20 t H i to3,h L bloi n t Ma C a c rt 10 IE N ME t e d o 0,h e h t 0 t ae t Fl ad h t e g e e e x hr t so 0. ae

123

Double click on t F n Sz t d p y h otSz ad o u i o ,ye 8 n h Sz f l h ot i o i l t F n i n C l r wn w t 1 i t i id e e sa e , e o d p e e e, press the return key and then click the OK button: 19.4 Form Trigger Click on the CAMERA in the Object Navigator and double click on the form Trigger attribute to display the Trigger editor and type the following:

19.5 Adding A Camera Click on the BLOCK1 in the Object Navigator. Click on the New Camera button on the top toolbar to display a new camera. Drag the camera to Position x = 0 and Position Y = 80. Update the Width to 30t H i to 4, e aet a e t L bl t 8 ad h F nSz t 1: 2, e e ht 20t L blo C m r , e aeY o 0 n t ot i o 8 h g h a h e e

19.6 Comments On Cameras The MobiForms Developer represents the camera object as a checkerboard pattern. When the form is run on the PC the checkboard pattern is also displayed.

124

Google Android devices use a range of different camera chips with range of different supported resolutions. In order to map the camera correctly in a MobiForms app the dimensions must be defined in proportion to those supported by the camera. For example if the camera supports 1600 x 1200 images, it should support a 320 x 240 camera object as above with the same aspect ratio of 1.333 (4:3). 19.7 Adding Camera Buttons Add the following camera buttons: BUTTON1 Position X0P si Y30L blT k Pc, ot i 8 ad r gr , oio t n 4, ae ae i F nSz 1 n Ti e e g : tk_itr(bok.aea,bok.ienm; aepcue:lc1cmr1:lc1fl_ae) BUTTON2 oio X16P si Y30L blR st F nSz 8 ad r gr P si t n 0, oio t n 4, ae ee , ot i 1 n Ti e e g : reset_camera(:block1.camera1); BUTTON3 Position 22P si Y30L blE i, ot i 8 ad r gr X 1, oio t n 4, ae x F nSz 1 n Ti e t e g : exit_form; From the top toolbar choose the File menu and then the Save option. The form is now complete as below:

19.8 Deploying The Form Section 18.0 describes how to use the MobiForms Deployment Wizard to automatically configure and install MobiForms on a Mobile Device. The Deployment Wizard is the recommended approach.

125

20.0 Multi-Record Blocks


A multi-record block enables a list of records from the same source to be represented in a grid. The following image shows a form loaded in the MobiForms Developer. The form is the mdiary.fml taken from the MobiForms Sync Server installation. Unlike the single record block, the multi-record cannot contain further object items beneath it.

The source of the data is either defined by the SQL statement in the Query attribute or the name of a CSV file in the File Name attribute. To select data from a multi-record block an assignment is made using the column number. The following image displays the trigger on the View button above. The :control.id field is assigned to the value of the data in the first column of block d1 from the current high-lighted record.

126

21.0 Sample Forms


The c:\program files\mobiforms\examples folder contains some additional sample forms: CAMERA.fml - Form from the MobiForms camera tutorial showing how to to create a simple camera app. DIARY.fml - Form from the MobiForms Sync Server tutorial showing how to select a data element from a multi-record block and use it as the basis of a dynamic where clause for a single record block. LISTEX.fml Form with a list, a multi-record block and save buttons showing how to read and save those items. MATHS.fml A fr wt f l ad fu m t m ta fnt nbt n adar u om i id a n b,or a e acluco u os n h es h i i t elc st field. MENUEX.fml A menu form showing how to call another form using the run_form built-in along with a passed parameter. Works in hand with the TIMEREX.fml form. TIMEREX.fml This form is called from MENUEX.fml and receives a passed parameter. Three buttons are available to demonstrate startingon, stopping and clearing a timer.

22.0 Future Options


MobiForms is continuously developing as a product. It is intended that future releases will include the following items: Programmable pull-down menu options. Additional support for other databases including IBM DB2 Express/Everywhere. Addition of MobiScript code parser and wizards in the MobiForms Developer environment Native support for Infrared port on mobile devices.

The order of these additions will depend on customer demand. The MobiForms development team also welcome additional ideas for future releases and these can be submitted to support@mobiforms.com.

23.0 Support
The purchase of a MobiForms licence includes a free first year of next working day support by email. Extended phone support or additional email support after the first year can also be made by prior arrangement at sales@mobiforms.com.

127

24.0 Licence Agreements And Acknowledgements


The MobiForms Licence Agreement This computer program is protected by copyright law and international treaties. Unauthorised reproduction or distribution is prohibited and may result in prosecution. Parts of this program may be embedded and resold inside third party applications with the express permission and a relevant licence from the copyright holder. This licence excludes the following free to download products included with the MobiForms distribution. Their licence agreements and warranties are listed below. These products are included on a no charge basis, but may include restrictions on their use. The HSQLDB Licence Agreement Copyright (c) 2001-2005, The HSQL Development Group. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. Neither the name of the HSQL Development Group nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. The SQLite JDBC Driver Licence Agreement Copyright (c) 2006, David Crawshaw. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN

128

ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. The jTDS SQL Server JDBC Driver Licence Agreement jTDS is Free Software. jTDS is made available under the terms of the GNU Lesser General Public License. The LGPL is sufficiently flexible to allow the use of jTDS in both open source and commercial projects. Using jTDS is considered to be dynamic linking; hence our interpretation of the LGPL is that the use of the unmodified jTDS source or binary does not affect the license of your application code. If you modify jTDS and redistribute your modifications, the LGPL applies, basically meaning that you'll have to make the modified version publicly available under the LGPL license too. This ensures that all users of the software have access to all future improvements. jTDS was initially based on software released under a BSD license by CDS Networks, Inc. and/or Craig Spannring, the author of the original FreeTDS JDBC driver from which jTDS is derived. Between releases 0.8.1 and 0.9 jTDS was completely rewritten so the original BSD license no longer applies. For more details see http://jtds.sourceforge.net/license.html. The Google Android Debug Bridge (ADB) Licence Agreement Copyright (c) 2006-2009, The Android Open Source Project Copyright 2006, Brian Swetland <swetland@frotz.net> Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.

129

"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses

130

granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS,

131

WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS The Google Android USB Driver Licence Agreement The .dll files here are distributed by Microsoft Corporation as part of the Windows Driver Kit (available at http://www.microsoft.com/whdc/resources/downloads.mspx) and included here as permitted by the Microsoft Software License Terms. The Oracle JDBC Driver Licence Agreement Prelude: The end user shall have no right to redistribute the Oracle JDBC Driver. The Oracle Corporation is the third party beneficiary of this Oracle JDBC Driver Licence Agreement. Oracle Technology Network Development and Distribution License Terms Export Controls on the Programs Selecting the "Accept License Agreement" button is a confirmation of your agreement that you comply, now and during the trial term, with each of the following statements: -You are not a citizen, national, or resident of, and are not under control of, the government of Cuba, Iran, Sudan, Libya, North Korea, Syria, nor any country to which the United States has prohibited export. -You will not download or otherwise export or re-export the Programs, directly or indirectly, to the above mentioned countries nor to citizens, nationals or residents of those countries. -You are not listed on the United States Department of Treasury lists of Specially Designated Nationals, Specially Designated Terrorists, and Specially Designated Narcotic Traffickers, nor are you listed on the United States Department of Commerce Table of Denial Orders. You will not download or otherwise export or re-export the Programs, directly or indirectly, to persons on the above mentioned lists.

132

You will not use the Programs for, and will not allow the Programs to be used for, any purposes prohibited by United States law, including, without limitation, for the development, design, manufacture or production of nuclear, chemical or biological weapons of mass destruction. EXPORT RESTRICTIONS You agree that U.S. export control laws and other applicable export and import laws govern your use of the programs, including technical data; additional information can be found on Oracle's Global Trade Compliance web site (http://www.oracle.com/products/export). You agree that neither the programs nor any direct product thereof will be exported, directly, or indirectly, in violation of these laws, or will be used for any purpose prohibited by these laws including, without limitation, nuclear, chemical, or biological weapons proliferation. Oracle Employees: Under no circumstances are Oracle Employees authorized to download software for the purpose of distributing it to customers. Oracle products are available to employees for internal use or demonstration purposes only. In keeping with Oracle's trade compliance obligations under U.S. and applicable multilateral law, failure to comply with this policy could result in disciplinary action up to and including termination. Note: You are bound by the Oracle Technology Network ("OTN") License Agreement terms. The OTN License Agreement terms also apply to all updates you receive under your Technology Track subscription. The OTN License Agreement terms below supercede any shrinkwrap license on the OTN Technology Track software CDs and previous OTN License terms (including the Oracle Program License as modified by the OTN Program Use Certificate). Oracle Technology Network Development and Distribution License Agreement "We," "us," and "our" refers to Oracle USA, Inc., for and on behalf of itself and its subsidiaries and affiliates under common control. "You" and "your" refers to the individual or entity that wishes to use the programs from Oracle. "Programs" refers to the software product you wish to download and use and program documentation. "License" refers to your right to use the programs under the terms of this agreement. This agreement is governed by the substantive and procedural laws of California. You and Oracle agree to submit to the exclusive jurisdiction of, and venue in, the courts of San Francisco, San Mateo, or Santa Clara counties in California in any dispute arising out of or relating to this agreement. We are willing to license the programs to you only upon the condition that you accept all of the terms contained in this agreement. Read the terms carefully and select the "Accept" button at the bottom of the page to confirm your acceptance. If you are not willing to be bound by these terms, select the "Do Not Accept" button and the registration process will not continue. License Rights We grant you a nonexclusive, nontransferable limited license to use the programs: (a) for purposes of developing, testing, prototyping and running applications you have developed for your own internal data processing operations; (b) to distribute the programs with applications you have developed to your customers provided that each such licensee agrees to license terms consistent with the terms of this Agreement, you do not charge your end users any additional fees for the use of the programs, and your end users may only use the programs to run your applications for their own business operations; and (c) to use the programs to provide third party demonstrations and training. You are not permitted to use the programs for any purpose other than as permitted under this Agreement. If you want to use the programs for any purpose other than as expressly permitted under this agreement you must contact us, or an Oracle reseller, to obtain the appropriate license. We may audit your use and distribution of the programs. Program documentation is either shipped with the programs, or documentation may accessed online at http://otn.oracle.com/docs. Ownership and Restrictions We retain all ownership and intellectual property rights in the programs. You may make a sufficient number of copies of the programs for the licensed use and one copy of the programs for backup purposes.

133

You may not: - use the programs for any purpose other than as provided above; - distribute the programs unless accompanied with your applications; - charge your end users for use of the programs; - remove or modify any program markings or any notice of our proprietary rights; - use the programs to provide third party training on the content and/or functionality of the programs, except for training your licensed users; - assign this agreement or give the programs, program access or an interest in the programs to any individual or entity except as provided under this agreement; - cause or permit reverse engineering (unless required by law for interoperability), disassembly or decompilation of the programs; - disclose results of any program benchmark tests without our prior consent. Program Distribution We grant you a nonexclusive, nontransferable right to copy and distribute the programs to your end users provided that you do not charge your end users for use of the programs and provided your end users may only use the programs to run your applications for their business operations. Prior to distributing the programs you shall require your end users to execute an agreement binding them to terms consistent with those contained in this section and the sections of this agreement entitled "License Rights," "Ownership and Restrictions," "Export," "Disclaimer of Warranties and Exclusive Remedies," "No Technical Support," "End of Agreement," "Relationship Between the Parties," and "Open Source." You must also include a provision stating that your end users shall have no right to distribute the programs, and a provision specifying us as a third party beneficiary of the agreement. You are responsible for obtaining these agreements with your end users. You agree to: (a) defend and indemnify us against all claims and damages caused by your distribution of the programs in breach of this agreements and/or failure to include the required contractual provisions in your end user agreement as stated above; (b) keep executed end user agreements and records of end user information including name, address, date of distribution and identity of programs distributed; (c) allow us to inspect your end user agreements and records upon request; and, (d) enforce the terms of your end user agreements so as to effect a timely cure of any end user breach, and to notify us of any breach of the terms. Export You agree that U.S. export control laws and other applicable export and import laws govern your use of the programs, including technical data; additional information can be found on Oracle's Global Trade Compliance web site located at http://www.oracle.com/products/export/index.html?content.html. You agree that neither the programs nor any direct product thereof will be exported, directly, or indirectly, in violation of these laws, or will be used for any purpose prohibited by these laws including, without limitation, nuclear, chemical, or biological weapons proliferation. Disclaimer of Warranty and Exclusive Remedies THE PROGRAMS ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. WE FURTHER DISCLAIM ALL WARRANTIES, EXPRESS AND IMPLIED, INCLUDING WITHOUT LIMITATION, ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT. IN NO EVENT SHALL WE BE LIABLE FOR ANY INDIRECT, INCIDENTAL, SPECIAL, PUNITIVE OR CONSEQUENTIAL DAMAGES, OR DAMAGES FOR LOSS OF PROFITS, REVENUE, DATA OR DATA USE, INCURRED BY YOU OR ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT, EVEN IF WE HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. OUR ENTIRE LIABILITY FOR DAMAGES HEREUNDER SHALL IN NO EVENT EXCEED ONE THOUSAND DOLLARS (U.S. $1,000). No Technical Support Our technical support organization will not provide technical support, phone support, or updates to you for the programs licensed under this agreement.

134

Restricted Rights If you distribute a license to the United States government, the programs, including documentation, shall be considered commercial computer software and you will place a legend, in addition to applicable copyright notices, on the documentation, and on the media label, substantially similar to the following: NOTICE OF RESTRICTED RIGHTS "Programs delivered subject to the DOD FAR Supplement are 'commercial computer software' and use, duplication, and disclosure of the programs, including documentation, shall be subject to the licensing restrictions set forth in the applicable Oracle license agreement. Otherwise, programs delivered subject to the Federal Acquisition Regulations are 'restricted computer software' and use, duplication, and disclosure of the programs, including documentation, shall be subject to the restrictions in FAR 52.22719, Commercial Computer Software-Restricted Rights (June 1987). Oracle USA, Inc., 500 Oracle Parkway, Redwood City, CA 94065." End of Agreement You may terminate this agreement by destroying all copies of the programs. We have the right to terminate your right to use the programs if you fail to comply with any of the terms of this agreement, in which case you shall destroy all copies of the programs. Relationship Between the Parties The relationship between you and us is that of licensee/licensor. Neither party will represent that it has any authority to assume or create any obligation, express or implied, on behalf of the other party, nor to represent the other party as agent, employee, franchisee, or in any other capacity. Nothing in this agreement shall be construed to limit either party's right to independently develop or distribute software that is functionally similar to the other party's products, so long as proprietary information of the other party is not included in such software. Open Source "Open Source" software - software available without charge for use, modification and distribution - is often licensed under terms that require the user to make the user's modifications to the Open Source software or any software that the user 'combines' with the Open Source software freely available in source code form. If you use Open Source software in conjunction with the programs, you must ensure that your use does not: (i) create, or purport to create, obligations of us with respect to the Oracle programs; or (ii) grant, or purport to grant, to any third party any rights to or immunities under our intellectual property or proprietary rights in the Oracle programs. For example, you may not develop a software program using an Oracle program and an Open Source program where such use results in a program file(s) that contains code from both the Oracle program and the Open Source program (including without limitation libraries) if the Open Source program is licensed under a license that requires any "modifications" be made freely available. You also may not combine the Oracle program with programs licensed under the GNU General Public License ("GPL") in any manner that could cause, or could be interpreted or asserted to cause, the Oracle program or any modifications thereto to become subject to the terms of the GPL. Entire Agreement You agree that this agreement is the complete agreement for the programs and licenses, and this agreement supersedes all prior or contemporaneous agreements or representations. If any term of this agreement is found to be invalid or unenforceable, the remaining provisions will remain effective. Remote Command Line Tool Acknowledgement The MobiForms team would like to thank Alexander Shilonosov email address shilonosova@mail.ru for kindly allowing the use of his remote command line tool rcmd.exe in the MobiForms Deployment Wizard. Trademark Acknowledgements MySQL and Oracle are registered trademarks of Oracle Corporation and/or its affiliates. Sybase and the marks listed at http://www.sybase.com/detail?id=1011207 are trademarks of Sybase, Inc. The authors of this manual acknowledge that all other company and product names mentioned may be trademarks of the respective companies with which they are associated.

135

Appendix A Installing The HTC Sync Utility And USB Driver


In order for the MobiForms Deployment Wizard to communicate with the Google Android smartphone, the necessary device specific USB driver must be installed. Each Android device manufacturer supplies the necessary USB drivers via their web page or a supplied disk. The following section discusses configuration for a HTC device, but is similar for the other manufacturers. The HTC Sync utility comes with the necessary USB driver required by the MobiForms Deployment Wizard. A.1 Installing the HTC Sync Utility Refer to the manufacturer's web site or search for the relevant driver on the internet. For example for HTC the HTC Sync utility is offered as the equivalent to Microsoft ActiveSync for connecting to HTC devices. The URL for HTC drivers is: http://www.htc.com/ca/support.aspx This displays as follows:

Currently the latest version of the HTC Sync is 2.0.8. Click on the link to display the download options and choose the nearest download server:

Press the download button and save the HTCSync.exe file into a temporary location. Double click on the file to begin the installation and choose the appropriate language:

136

Press the OK button. Eventually the InstallShield Wizard is displayed:

Press the Next button. Disable the anti-virus software as directed. The licence terms are displayed:

Accept the licence terms and press the Next button. The Setup Type window is displayed:

137

Choose the setup type as required and pres the Next button:

Press the Install button:

138

Eventually the install finishes:

Press the Finish button to confirm. The HTC Sync is then displayed:

A HTCSync icon is installed on the bottom PC toolbar. A.2 Connecting The Smartphone Connect the smartphone via the USB cable to the PC. On the Google Android smartphone screen pull down the USB icon on the top toolbar to reveal the "USB Connected" notification. Tap on the notification and press the Mount button. The Removable Disk window is displayed on the PC:

139

Choose "Open folder to view files using Windows Explorer" and press the OK button.

140

Appendix B - Installing HSQLDB


B.1 Downloading HSQLDB MobiForms comes with a complete free version of the HSQLDB version 1.8.0.7 encapsulated in the hsqldb.jar and the hsqldb.exe files in the MobiForms folder. HSQLDB is a free to use open source product. The version of HSQLDB included with MobiForms should be sufficient for most purposes. Should it become necessary later versions can be downloaded from the following web site: http://sourceforge.net/project/showfiles.php?group_id=23316 MobiForms is also certitified with the HXSQL database a commercial drop in alternative to HSQLDB. HXSQL can be purchased from the http://www.hxsql.com web site. The version of hsqldb.jar supplied with MobiForms has been recompiled with Java 1.3.1. For compatibility with mobile platforms later versions of HSQLDB (or HXSQL) must also be recompiled with Java 1.3.1 and the resultant hsqldb.jar copied back to the MobiForms folder. The HSQLDB download includes an Ant configuration script for this purpose. The official web site for HSQLDB can be found at http://hsqldb.org. The web site includes full documentation. Requests for support assistance or enquiries about HSQLDB should be directed to this web site. B.2 Configuring HSQLDB For MobiForms Double-click on the HSQLDB Manager icon in the MobiForms program menu option. The following logon screen is displayed:

Enter the following parameters: Setting Name: Type: Driver: URL: User: Password: TestDB HSQL Database Engine Standalone org.hsqldb.jdbcDriver jdbc:hsqldb:file:\sdcard\testdb sa <leave blank>

141

Press the Ok button. This will create a new folder on the C: drive called sdcard, if it does not already exist. It will then create a new database called testdb. Note that for mobile device compatibility the drive letter must be omitted in the URL. The URL must not contain space characters. The following screen is displayed:

Is lt df ldt aeui t p os pldw m n wt t srt t a hi a ntlh e u a bs s g h O t n u o n eu i h I e e dt co e s a e at a n e i l h e n ts a c follows:

142

T ii tlt df ldm nt t nt l .R f s t l t adt e i ui t i eu h n ash e u e osao a e e eh h e hn r v w s g h Ve m n s sl e a t ri b s r e f e e n e w wtt e eh r p i h R f s Te ot In the right hand top pane type the following SQL command: h e r e ion. select * from customer Pesh xctS L bt n C ni t th cni r i hs en ucs u ad hth qe r t E eu Q u o. ofm h t of uao a be sces ln t t ur s e e t r a e g tn f a e y has returned 50 rows as follows:

Exit the HSQL Database Manae ui t i eu n t x p o. gr s gh Fl m n ad h E i ot n n e e e t i

143

Appendix C Configuring SQL Server


MobiForms supports access to Microsoft SQL Server 6.5, 7, 2000, 2005 onwards and SQL Server Express Edition. SQL Server must be configured to accept TCP/IP connections via JDBC and contain the necessary demo tables required by the tutorials in this manual. This appendix goes through the necessary steps to check or configure SQL Server for this environment. The following instructions are for Microsoft SQL Server 2005 Express Edition but are very similar for other versions. C.1 The SQL Server Configuration Manager From the Windows Programs menu navigate to the Microsoft SQL Server 2005 menu and then the Configuration Tools menu. Choose the SQL Server Configuration Manager option. Click in the tree view to reveal the Protocols for SQLEXPRESS. Right click on the TCP/IP protocol:

The TCP/IP Properties window is displayed as below:

144

Confirm that the Enabled property is set to True. If the Enabled property is set to False, change it to True and press the Apply button. Click on the IP Addresses tab as follows:

In the IPAll section check that the TCP Dynamic Ports is blank and that the TCP Port is set to a value such as 1030. Press the Apply button to save any changes. This is the port that will be accessed remotely using MobiForms and is used in the MobiForms connect string. For mobile access this port must open or translated to through the internet gateway or router, and be accessible over the mobile network infrastructure. C.2 The SQL Server Managament Studio Express From the Windows Programs menu navigate to the Microsoft SQL Server 2005 menu and choose the SQL Server Management Studio Express option. The Connect to Server window appears:

Choose to connect using Windows Authentication and press the Connect button. The SQL Server Object Tree is displayed. Navigate down the Security branch, open up the Logins branch and click on the primary external user e.g. sa:

145

Right click on the user and choose the Properties option to display the Login Properties window:

Confirm that the user can login by SQL Server authentication and confirm the default database. The default database will hold the tables for the tutorials and the name used in the MobiForms connect string. The MobiForms SQL Server connect string is of the form //<server>:<port>/<database>. From the example above it would be //192.168.0.21:1030/master. C.3 Restart The SQL Server Services From the Windows Control Panel, navigate to Administrative Tools and invoke the Services option. Locate the SQL Server services:

146

Restart the SQL Server (SQLEXPRESS) and SQL Server Browser services enabling the TCP/IP listeners to start. C.4 Verify Connection By SQL Server Authentication Verify that the chosen user can connect by SQL Server Authentication by chosing the SQL Server Management Studio Express option from the Microsoft SQL Server 2005 menu. The Connect to Server window appears:

Choose to connect using SQL Server Authentication. Type the Login id and Password and then press the Connect button. The SQL Server Object Tree is displayed. C.5 Install The MobiForms Demo Tables Click on the New Query button on the toolbar. A query window appears on the right. From the c:\program files\mobiforms folder locate and open the SQLServerDemoTables.sql file. Copy and past the contents to the query window as below:

147

Press the Execute button on the top toolbar. Clear the query window and confirm that the tables and data now exists by running the following example query: select empno, ename from dbo.emp The query window should split into two and present a results window at the bottom with a list of records.

148

Potrebbero piacerti anche