TransForm Helper Features

TransForm is a service for building mobile, data collection forms. For more information on TransForm, click here

The TransForm service has no dependence on Alpha Anywhere. You can use TransForm without having to also use Alpha Anywhere and without having to have an Alpha Anywhere license. However, there are several helper functions and features in Alpha Anywhere that are designed to make working with TransForm easier.

 

TransForm API Explorer - The TransForm API explorer allows you to experiment with the TransForm API.

The TransForm API allows you to perform tasks in the TransForm service. Almost all tasks that can be performed in the TransForm service through the various TransForm user interfaces (i.e. Form Designer, Permissions, Management Console, Form Filler) can also be performed using the API.

The TransForm API is a REST API.

To open the TransForm API Explorer, select the Tools, Open TransForm API explorer command when the Web Control Panel has focus.

The dialog shows all of the API methods.

IMPORTANT In order to test any of the methods, you will first need to get an API key. To get an API key log into your account at https://transform.alphasoftware.com and from the Home tab, select the Developer Options, Get TransForm API key options.

Once you have your API key, click the Enter API Key button to enter your API Key. Alpha Anywhere will remember the key so you will not need to enter the key again.

When you create an API key you select the 'scopes' associated with the key. In the list of available API method shown in the image below, each method shows the required scopes for that method. For example, in order to call the CreateNewFormInstance method, your API key must grant either the ALL or CFI scope.

 

 

 

The API Explorer also shows help for each method. To see the help, select the Help pane shown in the image below.

 

 

 

 

When you have the Explore tab selected, if you select a method, the right hand part of the dialog will prompt for the method's parameters:

 

 

The required parameters are indicated with an * after the name.

After you fill in the required parameters, click on the Test button. Alpha Anywhere will make the REST API call and show you the result in the API Result pane. The dialog also has tabs called CURL, Node and Xbasic.

These tabs show code showing how to make the API call using either CURL, Node.JS, or Xbasic.

 

Xbasic Helper Functions - There are several Xbasic functions that make working the the TransForm API easier. These functions are shown below:

 

A5TransForm_CreateFormInstance() - Create a New TransForm Form Instance - This function is a wrapper on the TransForm CreateNewFormInstance API method. It allows you to create a new form instance and assign the instance to a particular user.

Creating a new form instance programmatically is typically done is "dispatch applications". When the user to whom the new form instance was assigned opens TransForm on their device and performs a refresh action, the new form instances assigned to that user will appear in the list of existing forms. This is called a "dispatch application" because a new task has been "dispatched" to a user.

 

Syntax:

P result = A5TransForm_CreateFromInstance(C apiKey, C formId,C formDataJSON,C assignTo)

 

Where:

 

 

Example:

Assume you have a form called "Pictures" and you want to create a new form instance with the data shown below, and you want to assign this new form instance to a user called user1@mycompany.com.

 

dim formId as c = "Pictures"

dim apikey as c = "xxxxxxxxxxxxxxxxxxxxxxxxxx"

dim assignTo as c = "user1@mycompany.com"

dim formDataJSON as c

formDataJSON = <<%txt%

{
    "field1": "value1",
    "field2": "value2",
    "photos": [
        {"photo": "https://mys3bucket.s3.amazonaws.com/image1.jpg"},
        {"photo": "https://mys3bucket.s3.amazonaws.com/image4.jpg"}
    ]
}

%txt%

 

dim pResult as p

pResult = a5TransForm_CreateFromInstance(apikey,formid,formdataJson,assignTo)

 

 

 

 

A5TransForm_GetData() Function - Gets the data for a TransForm form. The result can be paginated so as not to return too much data at once.

If you request paginated data you must specify the page size and page number. For example, you might specify a page size of 10 and page number of 2. This will return 10 records, starting with the 11th record.

Syntax

c JSONData = A5TransForm_GetData(C apikey, C formid [,L paginated [,N pageSize [,N pageNumber [,P Obj [,L flagDisplayWaitMessage]}}}})
 

 

Where:

 


 

Example:

Assume you have a form called "Pictures" and you want to retrieve the data for form

 

dim formId as c = "Pictures"

dim apikey as c = "xxxxxxxxxxxxxxxxxxxxxxxxxx"

dim jsonData as c

dim flagPaginated as l = .t.

dim pageSize as n = 10

dim pageNumber as n = 1

dim pResult as p

jsonData = a5TransForm_GetData(apikey, formid, flagPaginated, pageSize, pageNumber, pResult)
 

 

IMPORTANT: The A5TransForm_CreateFormInstance() and A5TransForm_GetData() functions are merely convenient ways to use the TransForm API from Xbasic. They do not add any additional functionality to the API and you could also have used the API in your Xbasic code to achieve the same results.

 

List Control - The List control can display data from a TransForm form. When you create a new List, the list of available options for the List's data source includes TransForm.

 

 

If you select the TransForm option, the List builder will display the following prompts where you can specify your TransForm API key, the ID for the form for which you want to display data and whether the data should be paginated (recommended if there are many form instances)