
Compose
Purpose for linking variables
You might have data you want to collect for all users interacting with your app, but you might want to be able to associate it with a particular user using your app. This example in this article will be handy to walk you through the process, so you can recreate it for your own app needs.
Start by setting up your variables using our guide here.
This guide has two parts:
- Planning and setting up your data structure
- Using your variables
Planning and setting up your data structure
Let's say you are car dealership running a customer satisfaction survey for the cars that have been purchased from your lot. You know you want to be collecting three sets of data from your customers: their demographic information, what car they purchased, and how they are liking their new car.
We're going to have three variables to collect all that information, plus one more variable to tie them all together using references.
In this example, we've already set up our app with the following three pages to collect information from our customers:
![]() |
![]() |
![]() |
Now, we'll need to create a data structure to support collecting information on each page and mapping them to the specific customer.
First, we'll start with adding new app variables. We will start by creating a new App variable by clicking on the 'New variable' button. Select Collection as your app variable type and name your variable. (Note your variable name will be only internal - but it will be important for reference and connecting purposes). Since all of the information we will be collecting from users in this example is about cars, we will name our app variable "Cars." To save click on Add:

Now we can begin adding the fields associated with the Cars variable, to do so hover over Cars and select New field. You can then select "text" as the field type and input your variable field name as "Make" (doing the same for "Model" and "Year"):

Repeat this for the other fields we are capturing for Customer information and Customer Satisfaction:

Great job! Now that we have our data collection set up, let's tie them all together! You can link different variables by using references.
In this example, we're going to use the Client Variables to save the car, customer, and satisfaction information to the specific client (remember, Client variables are specific to the particular user).
Create a new Client variable by clicking on the 'New variable' button. Select Single as your app variable type and name your variable. (Note your variable name will be only internal - but it will be important for reference and connecting purposes). Since all of the information we will be collecting from users in this example is about the user, we will name our app variable "My." To save click on Add:

Next, to create the reference to the other variables, create a new variable field by hovering over the "My" client variable we've just created – which will then display a "New field" button (yellow, below). Click on the button to edit your new variable field and name it (Note your variable name will be only internal - but it will be important for reference and connecting purposes). Important: you will need to make sure that when you create this variable you create it as a "Reference." When creating a reference, you will need to select the Variable you are referencing (in this case "cars").

Repeat this step for the other two datasets:

Great work! Now that our data structure is set up, we can start using these variables!
Using your variables
You can save data to variables by using response sets. If you haven't already, review our guide on response sets here.
In the Compose section, navigate to the interaction where you are collecting data and click to the right to open the response sets:

From the response sets, hover over the area underneath the response, click "Add another action" and select "Save data":

Select your target variable (in this case, "customer" since we are saving data on the "Customer Information" interaction):

Select to which variable field you are saving each piece of data:

Great! In the current configuration, data is being saved to the "customer" variable, but we still need to link it to the Client "my" variable. To save it to the specific user, click on "Advanced options":

Clicking on the dropdown will display all variables that use the currently selected variable as a reference:

Choose the "my" variable:

Click on "create" to save your selections:

Great work! Repeat these steps for the other two pages (cars and satisfaction):

Let's take a look at how our data tables are working
Once your app is in use, you can see how the variable references work by clicking on the "Celebrate" tab in the left-hand navigation:

Click on the "Data" tab to manage and view data:
Select the "my" variable from the Variable filter. Notice how each of the Variable references is an ID number with a link.

Click on the ID link to see the data on the referenced variable:

Next Steps:
Now that we can successfully save data, let's see how it's shaping up by learning more about viewing and downloading data here.



Comments
0 comments
Please sign in to leave a comment.