Our October update enables users of your apps to e-mail reports to you. You can also send collected app data to a server you run.
This is an advanced feature, which requires you to operate a server and write the software which accepts the data sent by the app (or have someone write the software for you). Most users are better server by having apps e-mail them the collected data, where the data can either be sent as text or as comma-separated values (CSV), which can easily be imported into spreadsheets or databases.
Having the data sent directly to a server operated by you has a number of advantages, though. You can essentially do anything you please with the data, enabling you to automate the data collection and to integrate the data with any existing systems you have, including databases. This post contains the technical information you need to work with the data.
This is what a button that sends data to your server looks like in Calcapp Creator and in the apps you build:
Adding a button to your apps
Your users send you data by pressing a button in your app that you add by pressing Add button in Calcapp Creator:
Buttons by default reset fields to their initial values. Change the action by selecting Action: Send data to server from the drop-down menu in the left-hand inspector:
Click the button in Calcapp Creator and start typing to assign a custom label. We recommend adding buttons to a separate caption-less group to create space between the buttons and the fields.
Use the inspector to determine if fields from only the current panel should be included in the data or fields from all panels (using the drop-down menu that initially reads Include fields from this panel). Type the HTTP endpoint that should receive the data in the Server address field. We highly recommend that you use a secure HTTPS endpoint to ensure that the data is not intercepted by a third party while in transit.
Technical information on the transmitted data
The data is sent using the POST HTTP request method as JSON
data. This data consists of an object with a single key, named
The corresponding value is a JSON object with one key for every calculation
panel that is part of the collected data. Every calculation panel key is
associated with an object representing the collected values in the form of an
object. This innermost object has a key for every field with a defined value
(leaving out blank values and error values).
Field values are not formatted, meaning that they do not heed the formatting instructions set in the inspector and the app designer, such as the number of decimal places to use and the associated units (such as “$” and “lbs”). Calcapp numbers map to JSON numbers, text strings map to JSON strings and logical values map to JSON boolean values.
Calculation panel titles and field captions are used for the keys, if possible. If a calculation panel has no title or a field has no caption, its name is used instead. All keys belonging to the same object are unique – a serial number in parentheses is appended if there is a name conflict.
Dates are numbers and use the same format as popular spreadsheets. The integer part of the number represents the number of days that have elapsed since December 30, 1899, and the fractional part represents the time of day. The number 10.75 thus represents the 9th of January, 1900, at 6pm (18:00). (0.75 means that three quarters of a day have elapsed.)
Here’s an example mirroring the examples given in the blog post on sending reports by e-mail:
Hidden fields are included in the data. You can use hidden
fields to calculate values that should be included in the transmitted data but
should not be visible to your users. You could, for instance, have a hidden
output field named Date connected to the formula
TODAY() to capture the
current date and time.
Communication is currently one-way, meaning that servers cannot communicate data back to the app for display purposes. If sending data to your own server proves popular, there is a wealth of functionality that we would like to enable, including the ability to communicate values back to the app, essentially enabling calculations to be moved to your server. That would be good for calculations that cannot be expressed using Calcapp’s function library and for calculations that need to rely on data that is changing constantly (such as prices). Let us know if this is something that interests you.