Application Builder

Blog
Application Builder
Monday, October 14, 2019PrintSubscribe
Announcing Offline Sync Add-On
Code On Time is pleased to announce Offline Sync Add-On!  This new product converts your online application into an offline app capable of running in disconnected mode on tablets, phones, and laptops. Simply enable the add-on in the project and mark a few pages as “offline”. This is it!


The application shown in the next screen shot has been rapidly constructed with Code On Time app generator.


End users can access this app in any modern web browser on a device with Wi-Fi and Cellular connectivity.

What if your end users do not have a robust network connection? Offline Sync is the answer!

Enable the add-on in the Settings | Features of the projects.


Click Finish and activate Project Designer

Select a data page that will be available in disconnected / offline mode. Enable “Offline” checkbox and save the page. Repeat as needed.

Exit designer and proceed to generate the app. 

Copy the URL of the app in the web browser.

Install Cloud On Time app from the App Store of your mobile device. This app is available for  iOS, Mac OS, Windows, and Android (November 2017).

Start the app on the device. Cloud On Time app looks virtually the same on all platforms.


Tap the Connect button, paste the application URL in the input and press Save. 


Tap OK and Cloud On Time will load your online application in the hosted web view. 

Cloud On Time will proceed to install the front end of your application as soon as you sign in. The front end is composed on HTML pages, JavaScript, CSS, and Fonts. The front end files are transferred from the online application to the device.



This will be followed by downloading of data linked to “offline” pages. Offline Sync will follow the discovered data relationships and transfer the relevant records. User identity and application access control rules will limit the number of records. Downloaded information is persisted in JSON format on the device next to the front end files.


Your application is now running on the mobile device in hosted web view.


The cloud icon with a checkmark is displayed next to the user avatar indicating that the user is working in offline mode. The availability of network connection is irrelevant since Offline Sync is executing all data requests directly on the device.


If data is changed then Offline Sync executes the requests to update, insert, and delete records directly on the JSON copy of data while storing the requests in the log file. The cloud icon will change to indicate that the synchronization with the cloud is required.


End user can work with the app for extended period of time, close the app and restart the device as needed. The changes are safely persisted on the device. If the application on the server is down then this fact will have no impact on the “offline” users.

A tap on the cloud icon will activate synchronization. This process does require a network connection and the application on the server to be running.


If the user taps on Synchronize button, then the log of changes is submitted to the application on the server for execution. Errors are returned to the device for user review and reconciliation. 

If the synchronization was successful and “Refresh Data” checkbox is not selected, then the log of changes on the device is cleared and the data on the device is considered to be “in-sync”. It means that the local data does not reflect the true state of the database on the server. 

If the user elects to refresh data, then the successful sync is followed by synchronization of the front end files and downloading of the complete dataset from the server. Once again the data will be limited to those records that the user can access as defined by application access control rules.

The pricing for Offline Sync starts at $9 USD per device per month. See the license agreement and pricing examples at https://codeontime.com/documents/offlinesync-eula.pdf


Code On Time will begin shipping purchased licenses on October 18, 2019. Links to download the software will be delivered via email. The automated distribution system for Offline Sync Add-On will be launched later this year.

Offline Sync Add-On relies on the Offline Data Processor (ODP) included in the framework of applications created with Code On Time app generator. ODP does not require licensing and enables the exciting new feature Transaction Data Input in both offline and online applications. 

If at least one Data View field is included in the form used to create new records, then the end user will be able to enter child data rows along with the master on the pages marked as “offline”. ODP accumulates new child records on the client and submits them alone with the master in a single transaction when the master record is saved.



Watch this cool feature in action at https://www.youtube.com/watch?v=szwlCLSS2JI&list=PLy2g3SjvDe2b2cl9i0msBaMVLntQucZtb&index=37&t=0s.

Offline Sync Add-On and Offline Data Processor are compatible with Code On Time v8.9.0.0 and up.

Wednesday, May 29, 2019PrintSubscribe
Multi File Upload
Code On Time release 8.7.11.0 introduces Multi-File Upload. End users can select multiple files and submit them for upload at once to create multiple database records. Application framework automatically inserts a table row for each file, uploads the file, and persists the data either to the database or to an external storage system.

Here is how it works:

1) Start upload.



2. Select multiple files.


3. Preview the selection and tap Submit.


4. Multiple database records are created for each file and associated with a parent if needed.



The feature is activated when the Upload action is executed by the data controller. A built-in form is displayed to allow selecting multiple files for upload.  User submits the form and the framework starts processing files one by one. For each file an Insert action is executed through the same data controller. By default, the view createForm1 is used to figure a list of data fields for Insert. An alternative view can be specified in Command Argument of Insert action.  Special fields are detected to store File Name, Content Type, and Length of the file. For child data views, the master field values are also included. If insert is successful, then the physical file is uploaded to the server and stored in the first on-demand field of Byte[] type. Failure to insert a record or to upload a file will interrupt the processing. The data view is refreshed when processing of all files has been completed.

Consider the following database schema that allows associating documents with the supplier records.



Table Docs defines three explicit fields to maintain information about the files: FileName, ContentType, and Length. The physical data will be stored outside of the database and processed with File System Blob adapter.

Start Code On Time and create an app with two data models - Suppliers and Docs. Next, start Project Designer and begin defining the new field with the name Data and type Byte[] in Docs controller. Mark the field as On Demand. Enter DocID in Source Fields and DocsData in On Demand Handler. Choose Thumbnail in On Demand Style drop down to have a file preview in the app. Save the new field and drag it to createForm1, editForm1, and grid1 in the Docs controller.



Select Docs data controller and enter the following in the Blob Adapter Config property:

Field: Data
Storage-System: File 
Path-Template: C:\app\DocsFileData\{DocID}-{FileName}
File-Name-Field: FileName
Content-Type-Field: ContentType
Length-Field: Length

Make sure that the specified folder C:\app\DocsFileData does exist on your device. Application will use the primary key of the Docs record and the file name to create physical copies of the files submitted to the virtual on-demand Data field.

Add a new action with command name set to Upload to action group Docs / Actions / ag3 .



Proceed to drag Docs controller onto Suppliers controller or copy Docs and paste onto Suppliers. This will create a new field with type DataView and name Docs in the fields of Suppliers controller. Drag the new field to editForm1 view in the same controller.




Run the application and select a supplier.



Select Upload action and choose multiple files to upload.



Tap submit and see the corresponding records appear in the app.


The entire process take a few seconds. User can choose individual records to add comment. There is also an alternative it to create one record at a time if a more deliberative data input mode is desired.



Multi-file upload significantly improves ease-of-use for document management applications.


Monday, May 27, 2019PrintSubscribe
Code On Time With Command Line
Code On Time release 8.7.11.0 makes possible creating mobile and web apps directly from command line. New command line parameters allow configuring, generating, and refreshing apps without requiring developer to go through Project Wizard and Model Builder. Now the app generator can be integrated in automated scripts to produce custom apps.



For example, the following command line will instantly produce a basic app:

codeontime -generate "c:\apps\app1" -theme "Citrus" -run -appname "Hello World"

The app will be displayed in the default web browser when the code generation is completed.


This application is not connected to a database and displays no data. Next command will connect it to a database and produce data models, data controllers, and pages for Products, Suppliers, and Categories. The app will have a built-in membership manager and content management system.

codeontime -generate "c:\apps\app1" -dbconnection "Data Source=;Initial Catalog=northwind-cmd;Integrated Security=True;" -objects products,suppliers,categories -dbmembership -dbcms



This command will remove CMS (Content Management System), enable reporting, change the theme to "Petal", and make the app display Shippers and Customers tables.

codeontime -generate c:\apps\app1 -dbcms false -reports -theme Petal -objects Shippers,Customers


Notice that previously specified project options are persisted in the project file and do not need to be re-entered. Use double quotes to surround property values with spaces. Value "true" for Boolean properties can be omitted.

The app generator folder is not included in the Path variable of the machine during installation. Make sure to add C:\Program Files (x86)\Code OnTime LLC\Code OnTime Generator path to the Path environment variable. Otherwise use a full path to the app generator executable codeontime.exe when using the app generator in command line mode.

The three core commands controlling the app generator from command line require a path to the project folder. If the specified folder does not exist, then it will be created. If there is no file DataAquarium.Project.xml in the specified location, then the file will be created with the default settings. All three commands will change the project file if the configuration options are also specified in the command line. 

-Config

Use -config command to create a project, change its options, or view the current option values. For example, this command will create a project configured for Microsoft SQL Server database, implemented in Visual Basic with MyBiz namepace, and build-in user and role management.

codeontime -Config "c:\apps\myapp1" -DbConnection "Data Source=;Initial Catalog=northwind-cmd;Integrated Security=True;" -Language VisualBasic -Namespace MyApp1 -DbMembership

This command will alter the project to have it presented in Berry theme. The app will start in a default web browser after the code generation.

codeontime -Config "c:\apps\myapp1" -Run -Theme Berry

The summary of the project configuration is display after successful -config command.




There will be a single file in the project folder.




-Generate 

Use -generate command to produce application source code. The app will be displayed in default web browser if -run option is specified for the project.

codeontime -generate "c:\apps\myapp1" 

Here is an example of application generated for the previously configured project. It includes every database object from the northwind database.




The project will look like this:



Please note that you can build this app with a single -generate command if you specify the same set of options in the command line. Command -generate first creates a project file or modifies the file according to the specified options. Code generation is performed only if every single configuration option has been successfully processed.

You can customize the generated app in the Project Wizard and Project Designer if you start the app generator without command line parameters and choose "Add an existing application" option. The new application will be displayed on start page.

-Refresh

Command -refresh deletes cached database metadata (information about tables, views, columns, etc) and rebuilds all data models, data controller, and corresponding pages from scratch. Use this command to generate the app if database schema has changed. 

It behaves just as -generate command in every other aspect.

-DbProvider

App generators supports many database engines. Option -DbProvider allows specifying the data provider for the app. By default, the assumption is that Microsoft SQL Server is the database engine of application. The equivalent command line option would be:

-dbprovider sqlclient

The supported data providers are the same ones available in the Project Wizard:


The command line processor will match the text specified by -dbprovider option in case insensitive fashion to one of the options in Supported Data Providers list.

Use mariadb or mysql for MySql or Maria DB server.

Use oracle for Oracle database.

Use ibm or db2 for DB2 databases.

Use sqlanywhere, postgres, or firebird for the corresponding database engines.

Automated App Building

The new command line support enables automated production of mobile and web applications with Code On Time app generator. Consider using Code On Time if you are a database administrator, application architect, or project manager. Just a few keystrokes will help to validate a database schema, provide high qualify data input screens, and eliminate tremendous amount of man hours.

Applications produced with Code On Time are metadata driven. Data modes and controllers are defined in XML files stored in ~/app/controllers folder of generated application. This makes possible to use the app generator to build apps from custom metadata. For example, a set of custom labels for table columns can be maintained in Excel spreadsheet or incorporated directly in the command line text manipulation commands. 

If your apply customization to data models then make sure to delete the corresponding data controllers. The app generator will build the dropped data controllers if you issue a -generate command. If you choose to modify the data controllers directly then the app will reflect the changes right away.

Code On Time v9

The upcoming new development environment incorporates the Project Designer and Object Inspector directly in the app. The development environment is activated at runtime from the app user interface. All project configuration options are arranged in a single hierarchy. The hierarchy will synchronize with the contents visible at the moment when developer activates "design" mode in the live app. Object Inspector presents properties of the selected hierarchy element in a unified presentation similar to the one found in Visual Studio. Developer will be able to perform live app inspection and drag hierarchy elements onto live pages.

New development environment is integrated into each app as add-on DLL. It will execute the app generator in command line mode when project configuration is changed. The add-on is removed from the code base when application is published.

The project creation and management will also change in v9. The app generator started without parameters will generate a management app displaying a list of projects. The management app will display in the default web browser.  A new project created from the management app will include a start page similar to the first app screenshot above. Developer will activate Project Designer from the live app to connect databases, create data models, pages, etc.