Standard Kony API

The Standard Kony API provides a set of functions as part of the kony Namespace that can retrieve and modify data from files, print data in the log files, and run tasks on worker threads. The Standard Quantum Visualizer API also contains functions and constants of the kony.nosql API to connect to a database and modify the data.

The Standard Quantum Visualizer APIs use the kony Namespace and the following API elements.

Quantum Visualizer APIs

Function Description
kony.convertToBase64 Converts rawbytes (returned by the camera or the encryption API) to a base64 encoded string.
kony.convertToRawBytes Provides your app with the ability to read rawbytes from a base 64 encoded string.
kony.evaluateJavaScriptInNativeContext Enables a web app JavaScript module, which is running in the Browser widget, to execute JavaScript code in the Quantum Visualizer native context.
kony.getError Retrieves an error object from a handle to the error object.
kony.props.getProperty Used to access parameters from an external properties file.
kony.print Prints debugging output.
kony.runOnMainThread Helps you run the JavaScript code on the main thread. It is an asynchronous API.
kony.runOnWorkerThread Provides apps with multithreding capabilities.
kony.type Retrieves the data type of the specified input.
 

Convert rawbytes returned by the camera or encryption APIs to a base64 encoded string using the kony.convertToBase64 function. To provide your app with the ability to read rawbytes, use the kony.convertToRawBytes function. Use the kony.getError function to retrieve an error object from the try/catch blocks. Using the kony.props.getProperty function, you can access parameters from an external properties file. Print the debugging output using the kony.print function, and retrieve data types of inputs using the kony.type function. To run a JavaScript code on the Main Thread, use the kony.runOnMainThread function. To provide multithreading capabilities to an app, use the kony.runOnWorkerThread function.

kony.nosql APIs

FunctionDescription
kony.nosql.addRecordsReplaces a record if the primary key matches, else the record is added.
kony.nosql.addOrReplaceRecordsReplaces a record if the primary key matches, else the record is added.
kony.nosql.clearTableClears the existing data in a table in the callback of openTransaction API.
kony.nosql.closeDatabaseCloses the database connection.
kony.nosql.createIndicesCreates indices for the specified table in the database.
kony.nosql.createTableCreates a table (object store) in the indexed database.
kony.nosql.databaseExistsSpecifies whether the required database exists or not.
kony.nosql.deleteDatabaseDeletes an existing database.
kony.nosql.deleteIndicesDeletes indices for the specified table in the database.
kony.nosql.deleteRecordsDeletes the rows that match the specified condition.
kony.nosql.deleteTableDeletes a table in the database.
kony.nosql.fetchRecordsReads the rows of a table.
kony.nosql.getPrimaryKeysFetches the primary key of the required table.
kony.nosql.getTablesReturns the list of tables in the selected database.
kony.nosql.openDatabaseOpens an existing database; if the database does not exist, however, the API creates the database and then opens it.
kony.nosql.openTransactionOpens a transaction in which you can execute any of the insert, update, or delete operations.
kony.nosql.replaceRecordsReplaces the records that match the provided condition. The API also updates the full record with a new set of columns.
kony.nosql.tableExistsReturns the appropriate Boolean value depending if the required table exists or not.
kony.nosql.updateRecordsUpdates rows and specific columns that match the provided condition.
 

Further, you can check whether a required database exists using the kony.nosql.databaseExists function. Use the kony.nosql.openDatabase function to open an existing database, or create a new database and open it. Once the database is open, use the kony.nosql.openTransaction function to open a transaction and execute operations. To close the connection to a database, use the kony.nosql.closeDatabase function. Delete existing databases using the kony.nosql.deleteDatabase function.

To check whether a table exists in the database, use the kony.nosql.tableExists function. Use the kony.nosql.createTable function to create a table in an indexed database. Retrieve the primary key of a table using the kony.nosql.getPrimaryKeys function. To retrieve a list of tables present in the database, use the kony.nosql.getTables function. To delete existing data in a table, use the kony.nosql.clearTable function, and delete a table in the database using the kony.nosql.deleteTable function.

Add a record in a table using the kony.nosql.addRecords function. To replace records matching a specific condition, use the kony.nosql.replaceRecords function. Replace a record matching the primary key using the kony.nosql.addOrReplaceRecords function. To view the rows of a table, use the kony.nosql.fetchRecords function. Update the rows and columns of a table using the kony.nosql.updateRecords function. Use the kony.nosql.deleteRecords function to delete the rows matching a specific condition.

NOTE: The setAppHeaders, setAppFooters, appreset, readfrombase64 APIs have been deprecated and must not be used to develop new software. However, documentation for them is provided to help in the maintenance of legacy software.

To view the functionality of the Standard Quantum Visualizer API in action, download the sample application from the link below. Once the application is downloaded, build and preview the application using the Quantum App.