π This blog post was created with AI assistance to help explain Uniface concepts in simple terms.
π What Are Field Lists?
A field list is like a shopping list for your Uniface component - it tells Uniface exactly which fields to load from the database at runtime. Instead of loading every single field from an entity (which can be slow and wasteful), Uniface intelligently loads only the fields that your component actually needs. π
Think of it this way: If you're building a customer list screen that only shows names and email addresses, why would you load all the customer's payment history, shipping addresses, and order details into memory? Field lists help you avoid this unnecessary overhead.
π¨ Three Types of Field Lists
Uniface 10.4 offers three different ways to manage field lists:
1. Automatic (Default) π€
This is the smart, hands-free option. Uniface automatically figures out which fields you need based on:
- Fields in your component data structure
- Fields that are part of primary, foreign, or candidate keys
- Fields referenced by name in your ProcScript code
- Fields with special formatting triggers (formatToDbms or formatFromDbms)
Note: Static fields and control fields are NOT included unless they're explicitly part of your component structure.
2. All Fields π
Sometimes you need everything. This option loads every single field from the entity. It's simple but can impact performance if you have large entities with many fields.
Good for: Service components (which use this as default) or when you're unsure which fields you'll need.
3. User-Defined βοΈ
This gives you complete control. You manually specify additional fields beyond what the automatic field list includes. Perfect for edge cases where you need specific fields that wouldn't normally be included.
β‘ Performance Benefits
Field lists are performance superstars, especially for presentation components. Here's why:
- Less Memory Usage: Uniface doesn't need to maintain excluded fields in memory
- Faster Processing: No time wasted converting and formatting fields you don't use
- Efficient Database Queries: All DBMS connectors support field subsetting
How it works: Excluded fields are still retrieved from the database, but Uniface doesn't format or convert them. When you save data, Uniface automatically adds the excluded fields back and sends a complete record to the database. πΎ
π οΈ Practical Example
Let's say you have a CUSTOMER entity with these fields:
- CUSTOMER_ID (primary key)
- FIRST_NAME
- LAST_NAME
- PHONE
- ADDRESS
- CITY
- ZIP_CODE
- CREDIT_LIMIT
- LAST_ORDER_DATE
You're building a simple customer lookup form that only needs to display the customer's name and email. Here's what happens with different field list settings:
With Automatic Field List π―
Your component structure includes: FIRST_NAME, LAST_NAME, EMAIL
Uniface automatically loads:
- CUSTOMER_ID (primary key - always included)
- FIRST_NAME (in component structure)
- LAST_NAME (in component structure)
- EMAIL (in component structure)
Result: Only 4 fields loaded instead of 10! That's 60% less data to manage in memory. π
With All Fields π¦
All 10 fields are loaded, even though you only use 3. This wastes memory and processing time for fields like ADDRESS, CREDIT_LIMIT, and LAST_ORDER_DATE that you never display or modify.
π¨ Important Considerations
When Field Lists Are Disabled
Field subsetting doesn't work in these scenarios:
- When using stored procedures
- When the Uniface Server manages the entity fields
- When a component calls another component - the first component's field list is used for both
ProcScript References
Only fields referenced by their literal name in ProcScript are included. Dynamic field references won't be automatically detected.
Example:
; This field WILL be included in automatic field list
$CUSTOMER.FIRST_NAME = "John"
; This field might NOT be included if referenced dynamically
vFieldName = "LAST_NAME"
$CUSTOMER.<<vFieldName>> = "Doe"
π‘ Best Practices
- Start with Automatic: Let Uniface do the heavy lifting. It's smart and handles most scenarios perfectly.
- Monitor Performance: If you notice slowdowns, check if you're loading unnecessary fields.
- Use All Fields Sparingly: Only use this when you genuinely need every field.
- Document Custom Lists: If you create user-defined field lists, document why specific fields were added.
- Test Component Interactions: Remember that called components inherit the parent's field list.
π― Quick Summary
Field lists are Uniface's way of optimizing data handling by loading only what you need. The automatic field list handles most situations perfectly, but you have the flexibility to load all fields or define custom lists when needed. This simple feature can significantly improve your application's performance and memory efficiency. π
Whether you're building a simple lookup form or a complex data entry screen, understanding field lists helps you create faster, more efficient Uniface applications!
Keywords:
- uniface
- performance
- database
- optimization
Top comments (0)