Understanding and Planning Tables in Knack

Learn the basics of tables in Knack and how to plan them effectively for your app. Whether you're building your first app or improving an existing one, good table planning will help you create a solid foundation.

What you'll learn:

  • What tables are and when to create them
  • How to plan your table structure
  • Real-world examples of table organization
  • Best practices for table planning

A table is simply a way to organize related information in your app. Think of it like a spreadsheet where each row represents an item or entry, and each column represents a specific piece of information about that item.

For example:

  • A "Customers" table stores information about your customers
  • A "Projects" table keeps track of your projects
  • An "Inventory" table manages your products or supplies

When to Create a Table

Create a new table when you need to track a distinct group of items or information. Ask yourself:

  • Is this a unique type of item I need to track?
  • Will I need to store multiple pieces of information about these items?
  • Will I have multiple entries of this type?

Tip: If you’re coming from an Excel or Access/SQL background, you can think of a table like a spreadsheet or a database table.

Example Scenarios:

✓ Create separate tables for:

  • Customers and Orders (two different types of information)
  • Products and Categories (each needs their own details)
  • Team Members and Departments (distinct groups)

✗ Avoid creating separate tables for:

  • Active and Inactive Customers (use a status field instead)
  • Small Products and Large Products (use a size field instead)
  • Current and Past Projects (use a date or status field instead)

Planning Your Tables

Before creating tables, consider:

  1. What Information You Need
    • List everything you want to track
    • Group similar items together
    • Identify which details belong together
  2. How Information Relates
    • Think about connections between different types of information
    • Consider what information you'll need to link together
    • Plan how different tables will work together
  3. Who Needs Access
    • Consider who needs to view or edit each type of information
    • Think about different user roles and their needs
    • Plan for privacy and security requirements

User Role Tables

User roles are essential for managing access and permissions in your Live App. They provide specialized permissions for users to log in and access specific data tailored to their role.

User roles are similar to tables, as they group data together, but they also include additional permissions.

​User roles are used to define the different types of users who will access your app, such as Employees and Managers. By assigning roles, you can create pages where Employees can only view their own assessments, while Managers have access to view all the assessments of their assigned Employees.

Understanding Fields

Fields are the individual pieces of data that make up a table.

Tip: Fields can be thought of as similar to the columns in a spreadsheet.

Real-World Examples

Event Management App

Tables needed:

  • Events (name, date, location)
  • Attendees (name, contact info)
  • Venues (address, capacity)
  • Sponsors (company info, contribution)

Project Management App

Tables needed:

  • Projects (name, deadline, status)
  • Tasks (description, due date)
  • Team Members (contact info, role)
  • Resources (equipment, materials)

Inventory System

Tables needed:

  • Products (name, description, price)
  • Categories (type, department)
  • Suppliers (company info, terms)
  • Stock Levels (quantity, location)

Tips for Success

  1. Start Simple
    • Begin with essential tables
    • Add more tables as needed
    • It's easier to expand than to simplify later
  2. Use Clear Names
    • Choose table names that describe their contents
    • Be consistent with naming
    • Make names clear to all users
  3. Avoid Duplicate Information
    • Don't create multiple tables for similar information
    • Use fields to differentiate items within a table
    • Connect tables rather than repeating information
  4. Think About the Future
    • Consider how your needs might grow
    • Plan for additional information you might need
    • Make sure your structure can scale

Tip: Some people find it helpful to sketch out your table structure on paper before building it in Knack. This can help visualize how everything fits together.

Next Steps

Once you've planned your tables:

  • Create your first table
  • Set up fields to store your information
  • Connect related tables together
  • Start adding your data