Zingy Docs
Visit our websiteTry a DemoPricingContact
  • Introduction
  • 🎛️Dashboard
    • Overview
    • Apps
    • Account Profile
    • Billing - View Invoices
    • Billing - Payment Methods
    • Billing - Subscription
  • 💻App Editor
    • App Components
    • App Editor Tour
    • App Settings
    • App Users
    • App User Groups
    • Publishing your App
    • Pages and Forms
      • Create a Page
      • Create a Structured Page
      • What is a Structured Page ?
      • Create a Form
      • Page Editor
      • Working with Forms
    • Page Editor
      • Page Editor Tour
      • Adding Page Content
      • Adding Content to Structured Pages
      • Working with Page Elements
      • Page Element Settings
      • Responsive Design
      • Padding and Margin
      • Editing Text
      • Using AI Wiz in the Page Editor
      • Built-in elements
        • Link
        • Image
        • Spacer
        • Flexible Area
        • Layout Container
        • Layout Row
        • Layout Column
        • 1 Column
        • 2 Columns
        • 3 Columns
        • Add Column
        • Table
        • Table Row
        • Table Column Cell
        • Table Heading Cell
        • Table (3 cols)
        • Table (4 cols)
        • Input
        • Checkbox
        • Toggle Switch
        • Dropdown
        • Multi-line
        • Label
        • Button
        • Button Group
        • Input Group
        • Button Toolbar
        • Menubar Holder
        • Menubar Collapsible
        • Menubar
        • Menubar Item
        • Menubar Item Link
        • Menubar Style1
        • Menubar Style2
        • Menu Item
        • Popup Menu
        • Popup Menu Item
        • Menubar Popup Menu
        • Popup Menu Style1
        • Popup Menu Style2
        • Popup Menu Separator
        • Card
        • Card Group
        • Card Style1
        • Card Style2
        • Card Style3
        • Alert
        • Badged Text
        • Collapsible Area
        • Data Table
        • Stripe Payment
        • Form
        • Menubar Login Info
        • Data Design
      • Working with Forms
      • Using Forms
      • Page Preview
    • Page Settings
    • Page Flow
      • Block Anatomy
      • Toolbox Blocks
        • Set Content
        • Get Content
        • Badged Text
        • Alert Text
        • Status Animation
        • Set Style
        • Set CSS
        • Set Input Value
        • Get Input Value
        • Set Toggle Switch State
        • Get Toggle Switch State
        • Set Input Feedback
        • Enable/Disable Element
        • Set Element Attribute
        • Get Element Attribute
        • Get Element by Name
        • Element
        • URL Parameter Value
        • Navigate Page
        • Timer
        • Timer Repeat
        • Show Popup Form
        • Show Information Popup
        • Show Confirmation Popup
        • Popup Form Data
        • Collapsible Area Action
        • Mouse/Keyboard Action
        • Event Action
        • Action/Event Info
        • Show Menu
        • Menu Text
        • Menu Index
        • Write Log Message
        • Log Category
        • Data Table Action Menu Customize
        • Data Table Attach Form
        • Data Table Add Action
        • Data Table Load Next Page
        • Data Table Load Prev Page
        • Data Table Refresh
        • Data Table Custom Query
        • Data Table : Table Name
        • Data Table : Data
        • Content from Data Design
        • Set Content in Data Design
        • Get Content in Data Design
        • Get Element Attribute in Data Design
        • Set Element Attribute in Data Design
        • Set Style in Data Design
        • Set CSS in Data Design
        • Set Input Value in Data Design
        • Get Input Value in Data Design
        • Get Toggle Switch State in Data Design
        • Set Toggle Switch State in Data Design
        • Set Input Feedback in Data Design
        • Enable/Disable Element in Data Design
        • Initialize Toggle Switch in Data Design
        • Event Action in Data Design
        • Collapsible Area Action in Data Design
        • Data Record Count
        • Data Record at Index
        • Data Record Loop
        • Data Record Info
        • Data Record Loop Index
        • Data Record ID
        • Data Table Name
        • Data Query Name
        • Data Read
        • Data Read Next
        • Data Read Previous
        • Data Lookup
        • Data Lookup with ID
        • Data Status
        • Data Add Record
        • Data Update Record with ID
        • Data Delete Record with ID
        • Data Input Popup
        • Lock/Unlock Form
        • Save Form with Data
        • Reset Form
        • Set Form Event Status
        • Set Form Event Status Message
        • Form Submit Complete
        • Set Field Input Value
        • Get Field Input Value
        • Form Data
        • Form in Edit Mode
        • Form Events
        • Execute Connection Command
        • Execute API Call
        • Connection Data
        • Connection Error
        • API Call Connection
        • Connection
        • Connection Command
        • Cloud Flow Invoke Hook
        • Cloud Flow : URL of Web Hook
        • HTTP Post
        • HTTP Get
        • HTTP Data
        • HTTP Error
        • Date
        • Custom Code
        • Date from Text
        • Get Object Property
      • Coding in Page Flow
      • Zingy API For Page Flow
      • References
        • Value Types
        • Popup Customization
        • Prerequisite for Dynamic Content block examples
        • Prerequisite for Data examples
    • Dynamic Content
    • Data
      • Database Tables
      • Database Queries
      • Data Tool
    • Cloud Flow
      • Cloud Flow Editor
      • Block Anatomy
      • Toolbox Blocks
        • Data Update Records
        • Data Delete Records
      • Coding in Cloud Flow
      • SDK/Library Integration
    • Media
    • Connections
      • Services
        • Stripe
        • Sendgrid
        • Twilio
        • API Call
        • API Key
Powered by GitBook
On this page
  • Managing Database Queries
  • Query Editor
  • Search Criteria
  • Field Selection
  • Sorting Order
  1. App Editor
  2. Data

Database Queries

PreviousDatabase TablesNextData Tool

Last updated 1 year ago

In Zingy, you can define your own Database Queries associated with .

Database Queries enable you to access the table's data with specific criteria, allowing your app to retrieve data quickly and efficiently.

Managing Database Queries

To manage the queries for a Database Table, click on the table and select the Queries option from the popup menu.

An example of the Database Query screen is shown in the image below.

In the above image, the Database Query screen lists all the currently saved queries (2) and allows:

  • Addition of new Queries (1)

  • Editing Queries (3)

  • Deleting Queries (3)


Query Editor

The Query Editor allows you to create new queries or edit existing ones. It consists of the following (refer to the image above):

  • Query Name (1) : Specify the unique name of the query. Please note that the query name cannot be changed after the query is created.

Search Criteria

The search criteria consists of a match expression. The expression can be something as simple as FirstName equals Input-1 , which will list records where the FirstName field exactly matches the provided input parameter (Input-1).

More complicated expressions with logical combinations (AND, OR, NOT) can also be constructed (more on this topic later in this page).

Adding a match expression

The image below shows the Match Expression editor.

The match expression is created as follows:

Condition
Description

=

!=

>

<

>=

<=

matches pattern

  • Input parameter (3) to use for the match. You can either choose an existing parameter or add a new one.

Here are some examples of match expressions:

  • Price is less than Input-1

    The value of the Price field is compared to the Input-1 parameter. If the value is less than the parameter, the record is output.

  • Email matches pattern specified in Input-1

Logical Combinations

You can logically combine multiple match expressions using the boolean AND , OR and NOT operations.

Clicking on the logical combination button (1) will bring up a popup-menu showing options for the logical combination operations (2).

After selecting the logical combination, the chosen match expression will be displayed as nested inside the selected logical combination group, as illustrated in the above image.

Just like a match expression, a logical combination group can also be grouped into another logical combination group using the the logical combination button (2) shown in the above image.

Examples of logical combination groups are provided below:

  • In this example, two match expressions, Email matches pattern specified in Input-1 and FirstName matches pattern specified in Input-1 are joined using an OR group.

    This will lead to the output of records where either the Email or the FirstName field's values correspond with the regular expression search using the Input-1 parameter.

  • Here, the two match expressions, Price is greater than Input-1 and Name matches pattern specified in Input-2 are merged using an AND group.

    This will lead to the output of records where the Price field's value exceeds the Input-1 parameter and the Name field's value aligns with the regular expression search using the Input-2 parameter.

  • In this example, an AND group contains an OR group and the match expression PhoneNumber matches pattern specified in Input-2 . The OR group includes two match expressions: FirstName matches pattern specified in Input-1 and LastName matches pattern specified in Input-1 .

    This will result in the output of records where the PhoneNumber field's value aligns with the regular expression specified in Input-2, AND either the FirstName or LastName fields correspond with the regular expression search using the Input-1 parameter.

Field Selection

Typically, when reading from the app's database, all the fields of the table are displayed. However, the Field Selection tab enables you to select only the specific fields you want to be outputted by the query.

To deselect a field click on the 'x' icon. This will move the field from the selected section to the field listing.

Sorting Order

By default, when you read from the app's database, records are listed in an internally determined order which typically is based on the time the record was created.

You can customize this behavior using the Sorting Order tab.

The image below shows an example where two fields FirstName (ascending) and PhoneNumber (descending) are selected. Selecting a field moves it out of the field listing and shows it in the selected section.

In the above example, the records will be sorted by FirstName field in ascending order. Records with the same FirstName, will be sorted by PhoneNumber in descending order.

To deselect a field click on the 'x' icon. This will move the field from the selected section to the field listing.

(2)

(3)

(4)

If you are adding your first match expression for the query, click on the button with the icon (1) as shown below. This will bring up the Match Expression editor.

Field (1): Choose one of the fields in the . The ID field is an automatic internal field that is part of every table. it provides an internally unique identifier for each record. The field listing will also show the ID field.

Condition (2): Choose one of the conditions for the match. The conditions shown are based on the of the field selected.

Checks if the field's value is equal (exact match) to the provided input parameter. Works for all field .

Checks if the field's value is not equal (not an exact match) to the provided input parameter. Works for all field .

Works for Numeric, Numeric (decimals) and Large Numeric field . Checks if the field's value is greater than the provided input parameter.

Works for Numeric, Numeric (decimals) and Large Numeric field . Checks if the field's value is less than the provided input parameter.

Works for Numeric, Numeric (decimals) and Large Numeric field . Checks if the field's value is greater than or equal to the provided input parameter.

Works for Numeric, Numeric (decimals) and Large Numeric field . Checks if the field's value is less than or equal to the provided input parameter.

Works for the Text field .

Does a match (case insensitive global search) of the field's value with the provided input parameter.

The Input-1 parameter is used as a . A case insensitive global search is conducted on the value of the Email field. If the match succeeds, the record is output.

You can now add more match expressions to the logical combination group by clicking in the icon (1) as shown below. This will bring up the .

The image below shows the Field Selection tab with no fields selected. The table's fields are shown with a icon. The field is an automatic internal field that is part of every table. it provides an internally unique identifier for each record. The field listing will also show the field.

To select a field, click on the icon. The image below shows an example where two fields FirstName and PhoneNumber are selected. Selecting a field moves it out of the field listing and shows it in the selected section.

To add a field, click on the icon and select the type (Ascending or Descending). You can sort using multiple fields, in which case the sorting will take place in the order you added them. If two records have the same values for a field, the next field in the sorting list will be assessed, and so on.

💻
➕
➕
➕
Database Table
regular expression
Search Criteria tab
Field Selection tab
Sorting Order tab
➕
Match Expression editor
regular expression
➕
Database Tables
type
ID
ID
types
types
types
types
types
types
type
Table menu: Queries
Database Query screen showing the Add New button (1), the query listing (2), popup menu with options (3).
Database Query editor showing the Query Name (1), Search Criteria tab (2), Field Selection tab (3), Sorting Order tab (4)
Adding the first match expression (1)
Match Expression editor showing the Field selection (1), Condition selection (2) and the Input parameter selection (3)
The logical combination button (1)
The logical combination popup menu (2)
The selected expression (2) after the OR group was chosen is now shown inside the OR expression (1)
Adding a match expression to a logical combination group (1). Combining one logical group into another (2).
The Field selection tab with no specific fields selected.
Example where two fields are selected.
The Sorting order tab with no fields selected.
Example where two fields are selected for sorting.