How-To Guide for "Hash Key"

Overview

The "Hash Key Field" is designed for creating unique identifiers for records within your dataset. This field type generates keys using hashing algorithms, ensuring security, uniqueness, and consistency. It is especially useful in scenarios where primary keys or unique identifiers are required for database operations.

Key Features

  • Customizable Prefix: Add a prefix to the generated key for easier identification.
  • Variable Size: Define the length of the hash key based on your application needs.
  • Multiple Hashing Algorithms: Choose the desired algorithm to customize the hash key format.

Steps to Configure the Field

Step 1: Select Field Type

  1. Navigate to your Data Form configuration.
  2. Add a new field or edit an existing one.
  3. From the Field Type dropdown, select Hash Key.

Step 2: Configure Field Details

  • Field Name: Assign a unique name for the field (e.g., unique_id).
  • Field Label: Provide a descriptive label for the form display (e.g., "Unique Identifier").
  • Explanation of the Empty Field: Add an optional description to guide users. Example:
    "This field generates a secure, unique identifier for each record."
  • Alignment: Specify the field alignment in the form:
    • Left: Default alignment.
    • Center or Right: Based on your layout preference.
  • Field Width: Define the width of the field (e.g., 100% width for full-row display).

Step 3: Configure Hash Key Properties

  • Hash Key Prefix:
    Optionally, add a prefix for better organization. Example: USER_, ORDER_, or DATA_.
  • Size of Hash Key:
    Define the desired size (e.g., 20 for a 20-character key). Adjust the size based on your system's requirements.
  • Algorithm for Hash Key:
    Choose from the dropdown options:
    • BinHex (20 chars): A binary-to-hexadecimal string.
    • Random Alphanumeric: Generates random strings based on the specified size.
    • MySQL Short UUID (17 chars): A compact version of a UUID.

Step 4: Enable Additional Options

  • Required Field: Check this box if the field must always contain a value.
  • Blank on Load: Enable this if the field should remain empty until data is loaded or generated.

Step 5: Save and Test

  1. Click SAVE after configuring the field.
  2. Test the form by ensuring:
    • The hash key generates correctly.
    • The format matches the chosen algorithm and size.
    • The prefix (if added) appears at the start of the key.

Example Configuration

Scenario: Generate unique user identifiers with a prefix.

  • Field Details:
    • Field Name: user_id
    • Field Label: "User ID"
    • Prefix: USER_
    • Size: 20
    • Hash Algorithm: Random Alphanumeric

Example Output:
USER_5G8K29ZXM12BQ7WY60T3


Troubleshooting

IssueSolution
Hash keys not generatingVerify that the field type is set to Hash Key and saved.
Incorrect size or formatDouble-check the Size of Hash Key and Algorithm settings.
Prefix not appliedEnsure the Hash Key Prefix is correctly entered and saved.

Best Practices

  • Define Unique Prefixes:
    Use meaningful prefixes to help identify the data source (e.g., USER_, PRODUCT_, TRANS_).
  • Optimize Key Size:
    Choose a size that balances uniqueness and storage efficiency.
  • Select Appropriate Algorithms:
    • Use Random Alphanumeric for general-purpose identifiers.
    • Choose BinHex for systems requiring hexadecimal formatting.
    • Use MySQL Short UUID for compatibility with database systems.

Summary

The "Hash Key Field" provides a robust way to generate unique identifiers for records in your database. With customizable prefixes, variable sizes, and multiple algorithm options, it is a versatile tool for creating secure and consistent identifiers. This guide ensures you can configure and implement the field type effectively in your forms.