As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only.
Join the TIBCO Community TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.
From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
Request access to the private WebFOCUS User Group (login required) to network with fellow members.
Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.
I'm trying to add text - overflow ellipses to the table columns so that if the values in the table column exceed certain width it shows ellipsis instead of the complete text. E.g. This is some long text that...
Thank you in advance.This message has been edited. Last edited by: MeM,
You could set up a define field with the text to a certain point ( number of characters ) then concatenate the '...'
Simplistic way:
DEFINE FILE XX NEWTEXTFLD/A13 = EDIT(fielname,'9999999999...'); END
The above can be combined with IF/THEN/ELSE based on what you want to do. You can set up another define field with the actual text length ( ARGLEN ) and use this to determine if you need to concatenate the ellipses or not.
Also, search the forum for ARGLEN, SUBSTRING and concatenation examples.
Thank you for using Focal Point. Tamra Colangelo IBI Focal Point Moderator
WebFOCUS 8x - BI Portal, Developer Studio, App Studio, Excel, PDF, Active Formats and HTML5
Posts: 487 | Location: Toronto | Registered: June 23, 2009
The problem with this is that you usually want to cut off the text at a certain length in centimeters or pixels (or inches in some countries).
That's difficult to do with a proportional font and requires that the font and size used are a given. Without those, it's not possible to calculate how many characters of a string fit within a given width.
I don't think WF has any built-in functionality to do this, so you'll either have to look at external code/tools or figure a method of calculating a string width for a specific font using WF.
There are open source libraries to calculate string widths for a given font and size, so it should be possible to write a C-function (or any of the other external languages that WF supports) and create a WF function to do this.
Another approach is to create a table with characters and their relative widths for a given font; that table can then be used to look up the relative width for each character in the string. You'll want to create a function to split your text into separate characters and calculate the cut-off string-length where it still fits within the given width. Perhaps doing this in passthru SQL would actually be easier.
And don't forget to take the length of the elipsis symbol into account
The third option is to open a case asking IBI to include something like this. That will take a while though, usually new features go into some future major release.
WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010 : Member of User Group Benelux :
I am sure that the keyword of SQUEEZE within the style used to do this but the only reference that I can find relates to using it in PDF or PS formats. It doesn't add the ellipses but an exclamation mark.
Or maybe it was only ever available for PDF and PS formats.
Alternatively you could play by using something like this -
-HTMLFORM BEGIN
<!DOCTYPE html>
<style>
td {
vertical-align: middle !important;
}
.truncate {
width: 150px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
color: red;
border: 1px solid #000;
}
</style>
-HTMLFORM END
TABLE FILE CAR
PRINT MODEL
BY COUNTRY
BY CAR
ON TABLE SET PAGE NOLEAD
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
grid=off, units=in, $
-* Note that this css file doesn't exist but allows the style within the HTMLFORM
-* section to be used. Weird I know,but it works :)
type=report, CSSURL='http://localhost:8080/approot/baseapp/doesnt_exist.css', $
type=data, column=MODEL, class=truncate, $
ENDSTYLE
END
-RUN
I should add that this should work but doesn't in my browser
T
In FOCUS since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2
WebFOCUS App Studio 8.2.06 standalone on Windows 10
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004
Ok, so TD tags do not like the "truncate" style, so here's a sledge hammer to crack a nut (well it is Christmas!) -
-HTMLFORM BEGIN
<!DOCTYPE html>
<style>
td {
vertical-align: middle !important;
}
.truncate {
width: 150px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
color: red;
border: 1px solid #000;
}
</style>
-HTMLFORM END
DEFINE FILE CAR
P_MODEL/A70 = '<div class="truncate">'||MODEL||'</div>';
END
TABLE FILE CAR
PRINT P_MODEL
BY COUNTRY
BY CAR
ON TABLE SET PAGE NOLEAD
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
grid=off, units=in, $
ENDSTYLE
END
-RUN
T
In FOCUS since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2
WebFOCUS App Studio 8.2.06 standalone on Windows 10
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004
-HTMLFORM BEGIN
<!DOCTYPE html>
<style>
td {
vertical-align: middle !important;
}
.truncate {
width: 100px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
color: red;
border: 1px solid #000;
}
.truncate:hover {
text-overflow: inherit;
overflow: visible;
}
</style>
-HTMLFORM END
DEFINE FILE CAR
P_MODEL/A70 = '<div class="truncate">'||MODEL||'</div>';
END
TABLE FILE CAR
PRINT P_MODEL
BY COUNTRY
BY CAR
ON TABLE SET PAGE NOLEAD
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
grid=off, units=in, $
ENDSTYLE
END
-RUN
T
In FOCUS since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2
WebFOCUS App Studio 8.2.06 standalone on Windows 10
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004
You'd have to have a play yourself. HFREEZE adds all sorts of goodies to the mix including JavaScript and CSS libraries. Look at the output within your browser using developer tools to understand how you might be able to merge the two requirements.
Of course this does highlight the need to be explicit when creating your post, in what you are trying to do as there could always be conflict between approaches, especially if you are using HFREEZE or Active Reporting.
T
In FOCUS since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2
WebFOCUS App Studio 8.2.06 standalone on Windows 10
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004
Out of curiosity, change the DIV to P (both opening and closing tags) to see what difference that makes. It might be the DIV that is being "challenging"!
T
In FOCUS since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2
WebFOCUS App Studio 8.2.06 standalone on Windows 10
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004