IBM Support

Wrapping text in BIRT fields when the text contains no spaces.

Troubleshooting


Problem

Fields in BIRT reports do not wrap if there are no spaces to break on.

Cause

There is an issue in BIRT 3.7.1 & 4.2.1 where report text fields will fail to wrap if there are no spaces in the text to break on.

Resolving The Problem

To address this issue, you can build a function into your report that will insert a hard return into the text field every 'n' characters. Place this function in the initialise portion of your report and attach the function to the problem field.

function wraptext(textToWrap) {
var wrappedText = '';
while (textToWrap.length > 0) {
wrappedText += textToWrap.substring(0,80) + '\n';
textToWrap = textToWrap.substring(80);
}
return wrappedText;
}


var assetParam = '';
assetParam = wraptext(params["assetnum"])

In this example, the text will wrap text at 80 characters.. you could adjust this by modifying the function.

[{"Product":{"code":"SSLKT6","label":"IBM Maximo Asset Management"},"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Component":"Report Admin","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"7.5;7.6","Edition":"Edition Independent","Line of Business":{"code":"LOB59","label":"Sustainability Software"}},{"Product":{"code":"SSLKT6","label":"IBM Maximo Asset Management"},"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Component":"Report Admin","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"7.1.1;7.5;7.6","Edition":"Edition Independent","Line of Business":{"code":"LOB59","label":"Sustainability Software"}}]

Document Information

Modified date:
17 June 2018

UID

swg21961573