This content originally appeared on DEV Community and was authored by Peter
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
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
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,+
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
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.
This content originally appeared on DEV Community and was authored by Peter