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

circle-exclamation

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

Jigx Code

The Azure SQL Docs solution is on GitHubarrow-up-right

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

circle-info

The Jigx function is listed twice, once for executing a stored procedure and once for executing a query.

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.

get-customers.jigx
# 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_GetAllCustomers

A 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?