Skip to main content

Intro to Databases and Scripting

Course Overview

Learn the basics of SQL databases and Python scripting. This course uses Ignition to help build familiarity with SQL tables, basic SQL queries, and simple Python code. Students will work with the core Ignition modules and design simple interfaces to build familiarity with SQL tables and basic queries, as well as use Python to work with data in Ignition.

This course is an excellent foundation for the Level 2 “Using Databases and Scripting in Projects” class for those with limited experience with Python scripting or SQL databases, or who want a refresher before diving into more complex topics.

Length: 4 days

Who is This Class For? What are the Class Expectations?

This class if for users that have some Ignition experience who are looking to learn more about Python and SQL in Ignition and how they can be used to improve your Ignition projects. No prior SQL or Python experience is required.

Important

This is a level 1 class, prior experience with Ignition is recommended but in depth knowledge is not required.

Suggested Class Pre-Requisites:

Topics Covered

Introduction to SQL

  • SQL and Relational Databases
  • Using Databases in Ignition
  • Named Queries
  • Understanding SQL SELECT Statements
  • Alias Fields
  • Filter Results
  • Filter on Multiple Criteria
  • Wildcards
  • Sorting Results
  • Working With Dates
  • Handling NULLs
  • Aggregate Functions and Group By
  • JOINs
  • Inserting, Updating, and Deleting Data
  • Update Data
  • Deleting Data

Introduction to Python

  • Understanding Python
  • Which Version of Python Does Ignition Use?
  • Scripting Languages
  • Executing Script on a Button Press
  • Scripting Console
  • Working with Variables
  • Comments
  • Built-in Functions
  • if Statements
  • String Formatting
  • Accessing Component Properties in a Script
  • Lists & Dictionaries
  • for loops
  • System Library Functions

Populate Views with Queries

  • Display Data in a Table
  • Create a Query for the Table
  • Visualizing the Data
  • Use Database Data in Embedded Views
  • Create a Parameterized Query
  • Add Visual Components
  • Create a Custom Property
  • Bind Components to the Custom Property
  • Using Expression Bindings
  • Use the Flex Repeater
  • Populate the Flex Repeater
  • Use a Script Transform to Populate the Flex Repeater

Insert and Update Database Records in Perspective

  • Insert Records
  • Improve a Form with Dropdowns
  • Update Data
  • Updating the Database with a Button Press
  • Modifying an Update Query
  • Updating the Database with a Button Press
  • Improving Data Input Forms

Parameterized Popup

  • Pre-populating a Data Entry Popup
  • Display Data in Popup
  • Update Data From Popup

Scripting and Tags

  • Store Tag Values in the Database
  • Creating Parametrized Update Query
  • Running the Query to Store Tag Data

Reporting

  • Display Database Data in a Report
  • Create a Dynamic PDF Reports
  • Run Reports in a Session

Dynamic Alarm Notifications

  • Calculated Rosters

Security

  • Named Query Security
  • Security in Scripting
  • isAuthorized System Function
  • Check Roles Through the Session Properties