Using BigText in a Report

As you properly know BigText can be used to handle large texts.
BigText is stored in records as Blob fields, so what to do if you like to use the BigText in a Report?

First you have to get the text from the Blob field. This is done by using streams.



See also one of my ealier posts about Strings: Strings larger then 250 characters

How do we now use the BigText in a Report? Reports cannot handle a Big Text variable, but a Text variable. So what you have to do is to read parts of the BigText, split it nicely and then fill it into a Text variable, which then can be used.

Ok – let’s look on some details.

Define an Integer DataItem. This is used to handle the run through of the BigText variable.

On the Integer – OnPreDataItem you should set the variable Pos.

Pos := 1


Pos is used to note which starting position you should get Text from.

Now on the AfterGetRecord add the code to handle the Text:

IF Pos > varBigText.Length THEN

varBigText_as_Text := WhereToSplit(varBigText_as_Text, Pos);

GETSUBTEXT returns text to the variable varBigText_as_Text from position Pos and number of characters to return is 100. 100 is the size of my Text variable.

Next we use the function WhereToSplit to get a nicely splitted text, and after this we are ready to use the Text in the Report 🙂

I assume you know how to add a Text variable to the Sections of a Report, so will not describe this 😉

The function WhereToSplit looks like this:

i := STRLEN(InText);

IF i = 0 THEN

WHILE (NOT (InText[i] IN [' ',',','.'])) AND (i > 1) DO
   i -= 1;

Pos += i;

IF i > 0 THEN
  outText := COPYSTR(InText,1,i);

It finds the last space, comma or point and splits the text there.

That’s all – now you can print Big Text in you Report 🙂

Be the first to comment

Leave a Reply

Your email address will not be published.


This site uses Akismet to reduce spam. Learn how your comment data is processed.