DEV Community

Peter + AI
Peter + AI

Posted on

Uniface 10.4: The blockdata Statement - Elegant Multi-line Text Definition

🎯 What is the blockdata Statement?

The blockdata statement in Uniface 10.4 is a powerful tool for defining constant text blocks. It enables developers to elegantly define multi-line texts and use them in ProcScript modules - particularly useful for long SQL statements, email templates, or message texts.

πŸ› οΈ Syntax and Parameters

The basic syntax is surprisingly simple:

BlockName:blockdata Delimiter
...
... text ...
...
Delimiter
Enter fullscreen mode Exit fullscreen mode

πŸ“‹ Parameters in Detail

Parameter Data Type Description
BlockName String Name of the block; maximum 8 characters
Delimiter String Beginning and end of the text block
text String All lines until the delimiter character

⚑ Important Rules and Restrictions

When working with blockdata, the following important rules apply:

  • πŸ”— The blockdata statement must be in the same ProcScript module as the reference
  • πŸ“ It must be at the end of the ProcScript module
  • πŸ”„ Multiple blockdata statements are allowed
  • πŸ’² Reference using $BlockName
  • 🚫 The hash character (#) is not allowed as delimiter
  • πŸ“ BlockName may be maximum 8 characters long

πŸ”§ Variable Substitution

An important point: Variable substitution with %% doesn't work directly:

vBlock = $my_block ; doesn't substitute variables
vBlockFinal = $string(vBlock) ; variables are substituted
Enter fullscreen mode Exit fullscreen mode

πŸ’‘ Practical Examples

πŸ“§ Example 1: Email Template

; trigger: Detail
TEXT = $reject
message "Standard refusal loaded in TEXT field."

reject:blockdata +
We regret to inform you that your qualifications do not match our current
vacancy and that we have hired somebody else. Your application
has been filed for future reference. Thank you for considering us.
Yours sincerely,+
Enter fullscreen mode Exit fullscreen mode

πŸ”„ Example 2: Usage in Operations

operation GET_TEXT1
 message/info $Text1
Text1:blockdata +
This is Text One+
;
end

operation GET_TEXT2
 message/info $Text2
;
Text2:blockdata +
This is text Two+
;
end
Enter fullscreen mode Exit fullscreen mode

🎨 Use Cases

The blockdata statement is particularly useful for:

  • πŸ“Š Long SQL statements - cleanly formatted and readable
  • πŸ“§ Email templates - structured definition of multi-line messages
  • πŸ—‚οΈ Error messages - centrally managed consistent texts
  • πŸ“ Reports - elegantly create formatted outputs

πŸ”₯ Conclusion

The blockdata statement is an underestimated but powerful feature in Uniface 10.4. It brings order to multi-line texts and makes code more readable and maintainable. Especially when working with complex SQL statements or email templates, it shows its strengths.

πŸ’¬ Have you ever worked with blockdata? Which use cases do you find most useful? Share your experiences in the comments!

πŸ€– This post was created with AI assistance and is based on the official Uniface 10.4 documentation.

Top comments (0)