This article is based on Uniface Documentation 10.4 and was created with AI assistance.
If you're working with legacy Uniface applications, you might encounter the fieldsyntax statement. While this feature is now deprecated, understanding it can be crucial for maintaining older codebases. Let's dive into what it does and why it's being phased out! π§
What is fieldsyntax? π€
The fieldsyntax statement was used to dynamically set syntax attributes for fields in Uniface applications. It allowed developers to control field behavior such as editability, visibility, and prompting during runtime.
Basic Syntax:
fieldsyntax Field, AttributeList
Example Usage:
fieldsyntax FIELD1, "NED,NPR"
Key Attributes ποΈ
Here are the main field syntax attributes you could use:
- NDI - Do not display the field content
- NED - Do not allow editing
- NPR - Do not prompt (not available in web environment)
- HID - Hide field completely (NDI + NED + NPR)
- DIM - Dim the field (no editing/prompting)
- YDI - Display field
- YED - Allow editing
- YPR - Allow prompting
Real-World Example π‘
Here's a practical example showing conditional field behavior:
if (DISCOUNT_1 != 0)
fieldsyntax DISCOUNT_2, "NED,NPR"
endif
This code makes the DISCOUNT_2 field non-editable and non-promptable when DISCOUNT_1 has a non-zero value.
Why is it Deprecated? β οΈ
The fieldsyntax statement has been superseded by the $fieldsyntax function, which offers:
- Better compatibility across all component types
- More consistent behavior
- Enhanced functionality
- Future-proof design
Migration Strategy π
If you're maintaining legacy Uniface code:
- Audit your codebase - Find all instances of
fieldsyntax - Plan migration - Replace with
$fieldsyntaxfunction calls - Test thoroughly - Ensure behavior remains consistent
- Document changes - Help future developers understand the updates
Important Notes π
- The
^CLEARand^RETRIEVEstructure editor functions reset field syntax - Some attributes like
HIDare not valid in character mode -
NPRis not available in web environments - Positive attributes (YDI, YED, YPR) can only be set programmatically
Conclusion π―
While fieldsyntax served its purpose in older Uniface versions, modern development should use the $fieldsyntax function. Understanding both helps maintain legacy systems while planning for future upgrades.
Remember: deprecated doesn't mean broken, but it does mean you should plan for migration! π
Have you worked with Uniface's field syntax features? Share your experiences in the comments below! π¬
Top comments (0)