Display Fetched Data in Your App
Display data fetched from a public API, such as product names and calorific information, in your SAP Build app.
Overview
You will learn
- How to display fetched API data in your app
Prerequisites
Steps
To start with, you’ll add further visual information to your app in the form of a title and a paragraph of text. This will eventually be used to display specific calorific information obtained from scanning a food item.
From the Core component tab, drag a Title component underneath your Scan button.

Add title component Click Headline in the Title component and type in
Product Information.
Change title text Drag a Text component underneath the title.

Add a text
You will now bind the Product Name field to the text component.
Select the Text component.
In the Properties tab, click the binding type square (shown as ABC or static text) for the Content property.

Click to bind Select Data and Variables.

Select data and variables Select Data Variables.

Select data and variables Click your OpenFoodFacts1 variable.
Scroll down to and select the
product_namefield. For this, we suggest using your browser’s search.
Product name variable Click Save.

Product name result Click Save (upper right).
The paragraph will now display the product name of the scanned food item.
We’ll now add the calorific information to your app, using the same steps provided for the product name.
Select the text component for the product, and duplicate it.

Add text component Select the duplicated text component, and click the binding (NOT the binding type square) for the Content property.

Click to bind Select the field under Select data variable field (currently assigned product_name).
Scroll down to and select the
energyfield. For this, we suggest using your browser’s search.
Product name variable Click Save.

Product name result Click Save (upper right).
We’ll now display the image for the product (if there is one).
Add an Image component after the calorific text field you added in the previous step.

Add image With the Image component selected, go to the Properties tab.
Click the binding square for the Source property.

Add image countrol Select Formula, and then enter following formula:
JavaScriptdata.OpenFoodFacts1.product.image_front_urlClick Save twice.
Click Save (upper right).

Image added
Your app is now complete.
It enables you to scan a barcode of a food item and retrieve the product name and calorific information.
Open the SAP Build Apps preview app, and select your app to preview.
If the preview app timed out, go to the Launch tab and reopen the app. Instructions are in the first tutorial of this mission.
Click Scan. The camera will open to let you scan a barcode.

Scan Scan this barcode.

Barcode The app should display the following information and image (it may take a few seconds to retrieve the information/image).

Scan results
Resources
Discussion
Share feedback on this tutorial or join the conversation in SAP Community.