ShortPoint Connect allows you to retrieve data dynamically from internal or external sources. While connections usually work immediately, you may encounter blank results or display issues when your source data format doesn't match ShortPoint's expected format.
The Map Results function can help you in these situations. This function is only available for the following ShortPoint connection types:
- REST API
- Site News
- Org News
- Hub News
- Current Site
- Other Site
- Site URL
- People Search
- RSS Feeds
- Web Service XML
- Microsoft Graph API
TABLE OF CONTENTS
- Prerequisites
- What Happens When Returned Data Is Incompatible with ShortPoint?
- Using the Map Results Function to Resolve Data Format Incompatibility
Prerequisites
- You have the latest ShortPoint SPFx version installed on your SharePoint site.
- You are a ShortPoint Designer with an active license.
What Happens When Returned Data Is Incompatible with ShortPoint?
ShortPoint needs data to be returned as a list (called an array), but some data sources send information in other formats. When the format doesn't match what ShortPoint expects, the connection fails because ShortPoint cannot understand or display the data correctly.
For example, connecting to a REST API that provides the following data will not work as expected:
Since the returned data is wrapped inside an object {} rather than an array [], ShortPoint cannot process it properly. Although this object contains an array with the correct values (result_data), ShortPoint cannot automatically identify this structure. If you check the ShortPoint fields, you'll notice that it fails to interpret the data structure from your REST API services.
Using the Map Results Function to Resolve Data Format Incompatibility
What is the Map Results Function?
The Map Results function executes after ShortPoint successfully connects to your data source but before passing the data to the ShortPoint element. It allows you to define how to process the returned data so it matches the format ShortPoint requires.
If you don't provide anything in the Map Results function, it will use the following default value:
This means the function will return the exact data received from the data source without any modification.
Considering the previous example, we need to pass the inner result_data array to the ShortPoint element, rather than the root object.
To solve this, we can simply write the following snippet inside the Map Results function:
We should now see the right processed data displayed in the Data Example area once we establish the connection:
How to Use the Map Results Function?
Follow the steps below on how to configure the data format using the Map Results function:
Step 1: Set up your connection
- Switch to Grid Mode to access ShortPoint Connect (it's currently only available in Grid Mode).
- In the Design Element settings, open the Connect tab.
- Select a connection type.
- Ensure that all the required fields are completed to establish a successful connection.
In our example, we are using the REST API connection type, and all we need to do is enter the URL.
Step 2: Enable Advanced Settings
Scroll down and look for the Enable Advanced Settings toggle. Switch it on.
Step 3: Update the Map Results field
Input your desired results display format in the Map Results field.
Step 4: Hit Connect
Once done, click the Connect button. You can then proceed to select the data you want to display in the Items tab and update your Design Element.
That is how you can configure the data source format to match what ShortPoint needs in any of the supported connection types.
Related articles:
- How to Add an HTTP Header to ShortPoint Connections
- Modify the URL Parameters for ShortPoint Connections
- Modify the URL Path for ShortPoint Connections