Information saved to AirData is stored in Org-level collections called Datastores. Datastores cluster objects by Profile rather than application, allowing:
- the sharing of information between applications, and
- the separation of information collected by different deployments of the same app.
All applications within an Org have access to the same Datastores.
Datastores and Profiles
Each Organization comes pre-configured with three default pre-built Datastores, one associated with each out-of-the-box profile:
Each profile is automatically connected to the corresponding Datastore. These pre-configured Datastores and profiles enable you to easily work with separate containers of data that tie to one application. For example, when building out an application and storing a user's contact information in AirData, app builders are able to use the Development profile to test writing data back to AirData. Then when ready to test, app builders can change the profile to QA and write data to the QA Datastore, and, when ready for production, the profile can be changed to Production to write to the Production Datastore.
Profiles contain the configuration information for a published instance of an application. You can modify the profile being accessed in the Studio by selecting a profile from the Profile Selection dropdown menu at the center top of the Studio, next to the application name.
New Datastores are created directly in the AirData Builder, by clicking on the '+' button to the right of the App Objects section in the Tree, and then selecting Create Datastore from the dropdown menu that appears.
To bind a profile to a new Datastore, select the profile in the Profile Selection menu and select the desired Datastore in Settings > Datastore. Upon saving, this will bind the Datastore to the Profile.
Using Profiles to separate App Object data
Whenever the structure of an App Object is defined or modified in AirData Builder, the designated object structure is saved across all relevant Datastores. App Object instances will be saved to separate Datastores depending on the profile being used to send information to AirData.
To demonstrate this, let's create two different sets of towing services for an app. One set will be mock data used in the Development environment for testing, and one set will be the data shown to the user in Production.
Go to AirData Builder. Select the Production profile from the Profile Selection menu at the top of the Studio. This profile is pre-configured to point to the Production Datastore.
Be mindful of the profile selected in the Profile Selection menu when testing and publishing your application, as it will directly impact the Datastore that the application will reference when querying AirData.
Create a new AirData App Object and name it "TowingCompanies". Give it the properties
phone). Enter two to three records of real towing companies, then Save your application. A modal will appear indicating the 'TowingCompanies' App Object will be created in the Production Datastore. Click Continue and Save. This will serve as the Production data.
Once you've established your Production data, change the profile in the Profile Selection menu to the Development Profile. Note that you still have access to the structure of the "TowingCompanies" App Object, but the table in the Stage is empty. Enter two or three new records of towing companies to represent test data. Click Save. A similar modal will appear to indicate the "TowingCompanies" App Object will be created in the Development Datastore. This will serve as testing data for the Production environment.
Switching between profiles will switch the data available when the Towing Provider database is queried.
Referencing the same App Object Database in multiple apps
As long as two separate applications are referencing the same Datastore, it is possible for both apps to query the same AirData table, including not just the structure of the App Object but the stored information as well.
Once an App Object has been created in one app, the same App Object can be imported into another. To import an App Object, go AirData Builder, click on the '+' icon next to App Objects, and select Import Object.
A modal will pop up with all of the App Objects in the Organization that can be imported. Find the App Object you want to import and click on the Import button to import it to the application. Then save your application and refresh the Studio.
Multiple apps will now have access to the same App Object Database. Changes made to the App Object by one application will be reflected in all of the others.
Updated 4 months ago