List customers (SELECT)
Learn how to execute SQL commands to retrieve a list of customers from an Azure SQL database and display it in a list jig. This document includes detailed Jigx code examples for executing stored proce
Best practice for production apps is to use REST as the data layer to access data and not directly integrate to SQL using the SQL data provider. The SQL data provider will be squiggled in blue to indicate it is not recommended, together with a message to use REST instead. See REST endpoints from Azure SQL for more information.
Scenario
Create a list of customers showing their names, email addresses, and locations. On the left is an avatar, and on the right is the country the customer resides in.
Resources
Scripts for creating Azure SQL tables and stored procedures Database Scripts
Jigx Code
The Azure SQL Docs solution is on GitHub

How it works
This example selects a list of data from a customer table in an Azure SQL database and returns it to the Jigx solution on the device using the SQL data provider's function, where it is stored in the SQLite database. In the list jig the data is selected from the SQLite database using a SQL query in a data source which in turn is used by the list jig to render the items.
Functions
A store procedure-based version of get-customers.jigx
The following Jigx function uses a stored procedure to fetch a list of data from Azure SQL.
# Jigx SQL function executing a stored procedure to select all customers from a table.
provider: DATA_PROVIDER_SQL
connection: customer.azure # Use manage.jigx.com to configure a SQL connection
method: execute #Use SQL stored procedure to interact with the data in SQL
procedure: sp_GetAllCustomersA query-based version of get-customers.jigx
The following Jigx function uses a SQL query to fetch a list of data from Azure SQL.
jig (screen)
Use a list type to configure a list of customers.
Since the data is already synced to the local Sqlite data provider, the jigs datasource is configured with a query to provide the data for use in the list.
Expressions are used to reference the exact data property required in each component.
index
Add the list of customers jig to the home screen.
Last updated
Was this helpful?