Focal Point Banner


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.


Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] Truncate and drill down based on field character length

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] Truncate and drill down based on field character length
 Login/Join
 
Member
posted
I am looking for ideas on how to do this:

I have a report that contains a 'Notes' field. The notes field can be quite lengthy some times and I would like to truncate it at 300 characters.

In cases where the field is less than 300 characters it will display the full note.

In cases where the field is more than 300 characters it will be cut off, but I would like to add the word "more..." at the end of the data so that a user can click on the word 'more...' drill down to see the full note in a new window.

I am thinking I can do a defined field that truncates at 300 characters, then a defined field that is simply the text "more...", then have a 'when' statement to add a column for the text "more..." if characters exceed 300.

Any ideas on how to approach this? Thanks in advance.

This message has been edited. Last edited by: LDW,


7.6.8
Windows xp
html
 
Posts: 22 | Location: Minneapolis, MN | Registered: January 24, 2008Report This Post
Expert
posted Hide Post
Here's one idea, instead of a drill-down, use JavaScript to hide/show an extra row when the data is longer than a given length. This is a working example that displays a + image if the MODEL length is greater than 12. Click on the + and the full MODEL is displayed in a new row.

-*-- Hide and Show TDs to demonstrate displaying extra data for a cell on a report

-SET &ECHO=ALL;

SET HOLDLIST   = PRINTONLY
SET ASNAMES    = ON
SET HOLDFORMAT = ALPHA
SET PAGE       = NOLEAD
-RUN

TABLE FILE CAR
PRINT
COUNTRY
CAR
MODEL
DEALER_COST
RETAIL_COST
SALES
COMPUTE COUNTER/I4 = COUNTER + 1;

BY COUNTRY                  NOPRINT
BY CAR                      NOPRINT
BY MODEL                    NOPRINT

ON TABLE HOLD AS H001
END
-RUN

DEFINE FILE H001
MODEL_SMALL/A10 = SUBSTR(25, MODEL, 1, 12, 12, 'A10');
LINK_OPEN/A200 = IF ARGLEN(24, MODEL, 'I4') LE 12 THEN MODEL ELSE
MODEL_SMALL || '&|nbsp;&|nbsp;<img id="idImg' || EDIT(COUNTER) ||
'" src="/approot/baseapp/1.gif" width="9" height="9"' ||
' onClick="fnToggle(''' || EDIT(COUNTER) || ''')">';

MODEL_EXTRA/A999 = IF ARGLEN(24, MODEL, 'I4') LE 12 THEN '' ELSE
'</TD><tr><td colspan=2></td><td colspan=4 id="idTD' || EDIT(COUNTER) || '" style="display: ''none'';">' ||
MODEL || '</td></tr>';
END
-RUN

TABLE FILE H001
PRINT
COUNTRY             AS 'Country'
CAR                 AS 'Car'
LINK_OPEN           AS 'Model'
DEALER_COST         AS 'Dealer,Cost'
RETAIL_COST         AS 'Retail,Cost'
SALES               AS 'Sales'
MODEL_EXTRA         AS ''

BY COUNTRY          NOPRINT
BY CAR              NOPRINT
BY MODEL            NOPRINT

ON COUNTRY SUBFOOT
" "

HEADING CENTER
"Car Sales"
" "

ON TABLE HOLD AS H002 FORMAT HTMTABLE

ON TABLE SET STYLE *
TYPE=REPORT,  GRID=OFF, SQUEEZE=ON, $
TYPE=HEADING, STYLE=BOLD, $
TYPE=TITLE,   STYLE=BOLD, COLOR=NAVY, $
ENDSTYLE
END
-RUN
-IF &FOCERRNUM NE 0 GOTO FOC_ERROR;

-SET &ECHO=OFF;

-HTMLFORM BEGIN
<html>
<head>
<title>Car Test</title>

<style type="text/css">
BODY { font-family: Arial, sans-serif; font-size: 10pt; }
TD { font-size: 10pt; }
U {text-decoration: none;}

</style>
<script language="JavaScript">

function fnToggle(vCounter)
{
vTD = eval("idTD" + vCounter);
vImg = eval("idImg" + vCounter);

if (vTD.style.display == 'none')
  {
  vTD.style.display = '';
  vImg.src = "/approot/baseapp/0.gif";
  }
else
  {
  vTD.style.display = 'none';
  vImg.src = "/approot/baseapp/1.gif";
  }
}
</script>
</head>

<body>
<center>

!IBI.FIL.H002;

</center>
</body>
</html>
-HTMLFORM END
-EXIT


You will need these two images, rename then to 0.gif and 1.gif and put them in your baseapp folder:


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Member
posted Hide Post
Thanks Francis. I like this idea better than the one I was thinking. I will give it a try.


7.6.8
Windows xp
html
 
Posts: 22 | Location: Minneapolis, MN | Registered: January 24, 2008Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] Truncate and drill down based on field character length

Copyright © 1996-2020 Information Builders