This article describes how to use Displayr's API to merge two data files and import the updated data file into an existing Displayr document.
In this example, the API merges a data set saved in a Displayr document containing 699 respondents with another data set containing 20 respondents. Finally, the API updates the Displayr document with the merged data set containing 719 respondents.
Requirements
- An Enterprise Displayr license with purchased View hours.
- A Displayr Document.
- Python (see How to Get Started with the Displayr API).
- Document secret (see How to Obtain the Document Secret for Use in the Displayr API).
- The name of the data set used in the Document.
- A second data set with matching the structure of the data set in our Document.
- The appenddata.zip file containing the Displayr API for merging data files.
- See Displayr API and Technical Reference for further details.
Please note these steps require a Displayr license.
Method
- Click here to download the appenddata zip file.
- Double-click on the file to open it.
-
The zip file contains a data file (PhoneExtra.sav) and a Python script for merging (appenddata.py).
Save both files somewhere on your computer or network. - Open the appenddata.py file using a text editor (eg Notepad if using Windows).
- OPTIONAL: On line 6, update host_name if you are an Enterprise user with a region-specific server location. This can be copied from your Displayr URL.
- On line 26, replace insert-document-secret with the document secret.
- On line 29 replace current-file-name with the name of the file used in the document; in this example, it's called Phone.sav. You can find the name of the data set in the Data Sources tree of your existing Document.
- On line 32 replace extra-data-file-name with the name of the file containing the additional data; in this example, it's called PhoneExtra.sav.
- Save and close the file.
- Run the script, as described in How to Get Started with the Displayr API.
See Also
How to Get Started with the Displayr API
How to Obtain the Document Secret for Use in the Displayr API
How to Import Data via the Displayr API