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 any skip statements 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 -1 or any negative value is not supported.
  • Without Printing Context: Always ensure $printing = 1 before executing skip to avoid unexpected behavior.
  • Decimal Numbers: While Uniface truncates decimal values to integers, it’s best practice to provide whole numbers (e.g., skip 2, not skip 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’

  1. Always Check Printing Status: Precede your skip statements with if ($printing = 1) to ensure they only execute when relevant.
  2. Use Meaningful Numbers: Choose skip values that effectively enhance readability, like skip 2 for major section breaks and skip 1 for subtle line spacing.
  3. Comment Your Code: Document the purpose of your skip statements. This aids future maintenance and understanding.
  4. 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:

  1. Identify the specific areas within your reports or documents where line spacing would be beneficial.
  2. Insert the skip statement within the appropriate printing triggers or ProcScript logic.
  3. Ensure the skip statement is encapsulated within a printing context check (if ($printing = 1)).
  4. 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.

Leave a Reply

Your email address will not be published. Required fields are marked *

Fill out this field
Fill out this field
Please enter a valid email address.
You need to agree with the terms to proceed