This blog post was created with AI assistance to help developers understand Uniface concepts better.
What is the 'set' Statement? π§
The set
statement in Uniface 10.4 is a simple but powerful command that changes the value of specific ProcScript functions to TRUE (which equals 1 in Uniface). Think of it like flipping a switch - it turns a function "on" by setting its value to 1.
Key Terms Explained π
- ProcScript: The programming language used in Uniface for business logic
- Function: A built-in command that performs specific tasks
- TRUE/FALSE: In Uniface, TRUE = 1 and FALSE = 0
- Component Types: Different kinds of Uniface applications (forms, reports, services)
How Does 'set' Work? βοΈ
The syntax is straightforward:
set ProcScriptFunction
When you use set
, it activates the specified function by changing its value to 1 (TRUE). This is only possible with certain built-in functions that support this feature.
Practical Example π‘
Here's a real-world example using $occcheck
(occurrence checking):
operation exec
; set $occcheck to TRUE to enable checking
name = $1
retrieve
set $occcheck(INVOICE) ; Enable checking for INVOICE entity
edit NAME
end; exec
In this example:
-
$occcheck
is a function that controls data validation -
set $occcheck(INVOICE)
turns on checking for the INVOICE entity - This helps prevent data inconsistencies during editing
Return Values π
The set
statement returns status codes in $status
:
- 0: Success! The function was reset properly β
- <0: Error - the function doesn't support
set
β
Where Can You Use It? π’
The set
statement works in most Uniface components, but with exceptions:
- β Forms and interactive components
- β Most service types
- β Self-contained Reports
- β Certain Service types
Best Practices π―
- Always check the documentation to see if a function supports
set
- Monitor
$status
after usingset
to handle errors - Use
set
strategically to enable features when needed - Remember that
set
turns functions ON - there might be corresponding commands to turn them OFF
Conclusion π
The set
statement is a fundamental tool in Uniface 10.4 for controlling function behavior. While simple in concept, it provides precise control over when certain features are active in your applications. Understanding how to use set
effectively will help you build more robust and controllable Uniface applications.
Top comments (0)