Uniface ‘skip’ Statement: Your Guide to Mastering Line Spacing in Reports and Printing
Creating professional and highly readable reports is crucial in any application. For Uniface developers, the skip statement is a fundamental ProcScript command that offers precise control over line spacing in printed documents. Whether you’re generating invoices, detailed reports, or any other print output, understanding how to use skip effectively can significantly enhance the presentation of your data.
What is the Uniface ‘skip’ Statement?
The skip statement is a core ProcScript command within Uniface, designed to insert a specified number of blank lines into your printed output. Essentially, it allows you to add vertical spacing, much like pressing the ‘Enter’ key multiple times in a word processor, but programmatically within your Uniface application’s printing logic.
ProcScript is Uniface’s powerful procedural programming language, used to define application behavior and implement business logic.
Basic Syntax of ‘skip’
The syntax for the skip statement is straightforward:
skip {Expression}
Here, Expression represents the number of lines you wish to skip. If you omit the expression, the skip statement defaults to skipping a single line.
Practical Examples of ‘skip’ in Action
Let’s look at some real-world examples to illustrate how the skip statement is used.
Example 1: Simple Line Skipping
To add a fixed number of blank lines:
skip 2 ; Skips 2 lines for a clear break
skip ; Skips 1 line (default behavior)
skip 0 ; Also skips 1 line (treated as default)
Example 2: Conditional Line Skipping for Enhanced Readability
Imagine printing invoices where you want to add space between invoices from different dates to improve readability:
trigger leavePrinted
; Check if printing is currently active
if ($printing = 1)
; Compare the current invoice date with the next one
compare/next (INVDATE) from "INVOICE"
if ($result = 0)
; If dates are different, skip 2 lines for visual separation
skip 2
endif
endif
end; leavePrinted
In this scenario, the Uniface application will automatically insert two blank lines whenever the invoice date changes, making the printed document much easier to digest.
Key Rules and Behaviors of the ‘skip’ Statement
To effectively utilize skip, it’s important to understand its core operational rules:
1. Printing Context is Essential
The skip statement is only active when Uniface is actively engaged in a printing operation. You can verify this using the $printing system variable:
$printing = 1: Indicates that printing is currently active.$printing = 0: Means Uniface is not printing, and anyskipstatements will be ignored.
2. Smart Page Break Handling
Uniface intelligently handles line skipping across pages. If you attempt to skip more lines than remain on the current page, the system automatically performs an eject (a page break) and continues the line skipping on the subsequent page. This ensures your formatting remains consistent without manual page break calculations.
3. Immediate Execution
When Uniface encounters a skip statement, it executes immediately. This means that no other triggers or processing will occur on the current line before the skip action is performed.
What Not to Do with ‘skip’
- Negative Numbers: Using
skip -1or any negative value is not supported. - Without Printing Context: Always ensure
$printing = 1before executingskipto avoid unexpected behavior. - Decimal Numbers: While Uniface truncates decimal values to integers, it’s best practice to provide whole numbers (e.g.,
skip 2, notskip 2.5).
Why Use ‘skip’?: Common Use Cases
The skip statement is invaluable for:
-
Report Formatting
- Adding clear visual separation between different sections of a report.
- Creating structured breaks in data presentation.
- Significantly improving the overall readability and aesthetic appeal of documents.
-
Invoice and Document Generation
- Separating details for different customers or transactions.
- Adding space before totals, summaries, or legal disclaimers.
- Crafting professional-looking and organized layouts for business documents.
Enhancing Your Prints: Related Uniface Commands
The skip statement integrates seamlessly with other Uniface printing commands:
eject: Forces an immediate page break.print: The primary command for printing data to an output device.printbreak: Controls how lines break within printed text.
Best Practices for Using ‘skip’
- Always Check Printing Status: Precede your
skipstatements withif ($printing = 1)to ensure they only execute when relevant. - Use Meaningful Numbers: Choose skip values that effectively enhance readability, like
skip 2for major section breaks andskip 1for subtle line spacing. - Comment Your Code: Document the purpose of your
skipstatements. This aids future maintenance and understanding. - Test Your Output Thoroughly: Always preview or print test versions of your reports to confirm that the formatting is as intended.
Getting Started with the Uniface ‘skip’ Statement
To begin incorporating the skip statement into your Uniface applications:
- Identify the specific areas within your reports or documents where line spacing would be beneficial.
- Insert the
skipstatement within the appropriate printing triggers or ProcScript logic. - Ensure the
skipstatement is encapsulated within a printing context check (if ($printing = 1)). - Test your printed output rigorously and fine-tune the skip values until you achieve the desired presentation.
While seemingly simple, the Uniface skip statement is a vital component for producing polished, professional, and easily readable printed documents. By mastering this command, you gain a significant degree of control over your application’s output formatting.