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] Does anyone have a technique for coloring a portion of a string

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] Does anyone have a technique for coloring a portion of a string
 Login/Join
 
Master
posted
Standard styling will color whole strings, but I want to highlight where in a string a search match has occurred. eg we are searching for lmno
and the result is

abcdefghijklmnopqrstuvwxyz

Has anyone come up with a nifty technique for doing this. I searched the forums and came up with diddley.

What would be awesome would be that it worked for html, pdf, exl2k, but HTML only would be enough.

Here's hoping

John

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



Server: WF 7.6.2 ( BID/Rcaster) Platform: W2003Server/IIS6/Tomcat/SQL Server repository Adapters: SQL Server 2000/Oracle 9.2
Desktop: Dev Studio 765/XP/Office 2003 Applications: IFS/Jobscope/Maximo
 
Posts: 888 | Location: Airstrip One | Registered: October 06, 2006Report This Post
Expert
posted Hide Post
Hi John,

THANKS!! for getting my mind working this morning!!! Appreciate it...

You'll have to play around with the POSIT stuff when the string is in different places, AND,
I couldn't get the dynamic field format to work in a DEFINE,
BUT, this works:

  
-SET &SEARCH = 'lmno';
-SET &LEN    = &SEARCH.LENGTH;
DEFINE FILE CAR
COL1/A26 = 'abcdefghijklmnopqrstuvwxyz';
COL1_A1/I2 = POSIT(COL1, 26, '&SEARCH', &LEN , 'I2');
COL1_A2/A4 = SUBSTR(26, COL1, COL1_A1, COL1_A1+3, 4, COL1_A2);
-******************************************************************
COL1_B1/I2 = IF COL1_A1 EQ 1 THEN &LEN ELSE COL1_A1 - 1;
COL1_C1/I2 = COL1_B1 + &LEN;
COL1_D1/I2 = IF COL1_C1 EQ 26 THEN 26 ELSE 26 - COL1_C1;

XFMT1/A8   = IF COL1_B1 EQ 0 THEN  'A' ||  EDIT(COL1_D1)
               ELSE 'A' ||  EDIT(COL1_B1) ;
XFMT2/A8   = IF COL1_D1 EQ 0 THEN 'A' ||  EDIT(COL1_B1)
               ELSE 'A' ||  EDIT(COL1_D1) ;
END
TABLE FILE CAR
SUM
  XFMT1
 BY COUNTRY NOPRINT
IF RECORDLIMIT EQ 1
 ON TABLE SAVE
END
-RUN
-READ SAVE &XFMT1.A8.
-TYPE &XFMT1
TABLE FILE CAR
SUM
  XFMT2
 BY COUNTRY NOPRINT
IF RECORDLIMIT EQ 1
 ON TABLE SAVE
END
-RUN
-READ SAVE &XFMT2.A8.
-TYPE &XFMT2
TABLE FILE CAR
SUM
    COL1_A1
    COL1_A2
    COL1_B1
    COL1_C1
    COL1_D1
    XFMT1
    XFMT2
    COMPUTE COL1_A3/&XFMT1 = SUBSTR(26, COL1, 1, COL1_B1, COL1_B1, COL1_A3);
    COMPUTE COL1_A4/&XFMT2 = SUBSTR(26, COL1, COL1_C1, 26 , COL1_D1, COL1_A4);
    COMPUTE SHOW_DATA/A300 = '<FONT color="black">' | COL1_A3 | '</FONT>' | '<FONT color="red">' | COL1_A2 | '</FONT>' | '<FONT color="black">' | COL1_A4 | '</FONT>';
 BY COUNTRY
END
-EXIT


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
 
Posts: 1972 | Location: Centennial, CO | Registered: January 31, 2006Report This Post
Expert
posted Hide Post
Here's another solution for HTML only:

-SET &ECHO=ALL;

-SET &SEARCH = 'A';

-SET &STRREP = '<span class=hi>' || &SEARCH || '</span>';

TABLE FILE CAR
PRINT
COMPUTE COUNTRYX/A100 =
  STRREP (10, COUNTRY, 2, '&SEARCH', &STRREP.LENGTH, '&STRREP', 100, 'A100');

WHERE COUNTRY LIKE '%&SEARCH|%'

ON TABLE HOLD AS H001 FORMAT HTMTABLE
END
-RUN

-HTMLFORM BEGIN
<html>
<head>
<style type="text/css">
.hi { color: red; }
</style>
</head>

<body>
!IBI.FIL.H001;
</body>
</html>
-HTMLFORM END


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
Expert
posted Hide Post
Francis,

EXCELLENT!!!

Great idea - this is much better! I always take the long and winding road!!

Now, if Mickey see's this, he may assist with the PDF version!!!

Tom


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
 
Posts: 1972 | Location: Centennial, CO | Registered: January 31, 2006Report This Post
Master
posted Hide Post
Good work both Tom and Francis

Ironically Francis' technique seems simpler but if you uppercase the string in order to do a case unsensitive search you still have to use Tom's technique to reinsert into the original not uppercased string.

I'm thinking as well along lines of letting wf do the work of generating a red class by putting a dummy entry into the styling sheet and using that in the class statements. That avoids the HTMLFORM but could be a bit risky seeing that the names of the styles .x1, .x2 etc could change.

Thanks for your ideas - both of you.



Server: WF 7.6.2 ( BID/Rcaster) Platform: W2003Server/IIS6/Tomcat/SQL Server repository Adapters: SQL Server 2000/Oracle 9.2
Desktop: Dev Studio 765/XP/Office 2003 Applications: IFS/Jobscope/Maximo
 
Posts: 888 | Location: Airstrip One | Registered: October 06, 2006Report This Post
Expert
posted Hide Post
John,

Glad it is working out for you. Both ideas also work for EXCEL with:

SET HTMLFORMTYPE = XLS

Safe and Happy Holiday's to all.

Tom


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
 
Posts: 1972 | Location: Centennial, CO | Registered: January 31, 2006Report This Post
Master
posted Hide Post
You too Tom

Have never seen HTMLFORMTYPE = XLS. Will try.

BTW if you want PDF look alike with html try FORMAT DHTML.

Tried to do this

TYPE=DATA,COLOR=RED,WHEN=1 EQ 2, $

Hoping wf would define a class that it never uses but for a class to be in the HTML generated it needs to be referenced so it looks like -HTMLFORM it is.

Regards

John



Server: WF 7.6.2 ( BID/Rcaster) Platform: W2003Server/IIS6/Tomcat/SQL Server repository Adapters: SQL Server 2000/Oracle 9.2
Desktop: Dev Studio 765/XP/Office 2003 Applications: IFS/Jobscope/Maximo
 
Posts: 888 | Location: Airstrip One | Registered: October 06, 2006Report 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] Does anyone have a technique for coloring a portion of a string

Copyright © 1996-2020 Information Builders