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.



Read-Only Read-Only Topic
Go
Search
Notify
Tools
question on styling
 Login/Join
 
Gold member
posted
I need to change the color for the part of the data populated in a column. Did anyone try the styling for this?

I have a report that has description column which has around 60 characters. User enters the part of description and the report is supposed to retrieve the records that contains the part of the description. Now my question, can the report be styled to highlight the part of the description that the user entered? basically I am trying to add the search functionality like in PDF or HTML where the word gets highlighted when we search for a word.

For example:
Description column has data like this:
testing of the data

when user enters the parameter testing in the launchpage and hits submit, I need to get the report with testing as the highlighted word and the rest of the description.
Is it doable?
 
Posts: 76 | Registered: October 28, 2003Report This Post
<Pietro De Santis>
posted
Here's the 90 dollar answer. The MOVIES DB should be available in the IBISAMP app directory.

-DEFAULT &STRING2 = 'THE';

TABLE FILE MOVIES
PRINT
TITLE
-* Compute String Length
COMPUTE STRING1_LEN/I4 =
ARGLEN(39, TITLE, 'I4'); NOPRINT
-* Replace Space char by ^ char
COMPUTE STRING1/A39 =
CTRAN(STRING1_LEN, TITLE, 32, 94, STRING1); NOPRINT
-* Determine position of search string
COMPUTE POS_STRING2/I3 =
POSIT(STRING1, 39, '&STRING2', &STRING2.LENGTH, 'I4'); NOPRINT
-* Extract text from beginning to before search string
COMPUTE BEG_STRING1/A39 =
SUBSTR(39, STRING1, 1, POS_STRING2-1, 39, BEG_STRING1); NOPRINT
-* Extract text from after search string to end
COMPUTE END_STRING1/A39 =
SUBSTR(39, STRING1, POS_STRING2+&STRING2.LENGTH, 39, 39, 'A39'); NOPRINT
-* Create new string including styling
COMPUTE STRING3/A200 =
BEG_STRING1 || '<font color="blue">' || '&STRING2' || '</font>' || END_STRING1; NOPRINT
-* Replace ^ char by space char
COMPUTE STRING4/A200 =
CTRAN(200, STRING3, 94, 32, STRING4);
BY CATEGORY
WHERE TITLE CONTAINS '&STRING2'

ON TABLE SET PAGE NOLEAD
ON TABLE SET STYLESHEET *
TYPE=REPORT, GRID=OFF, FONT='VERDANA', SIZE=8, $
ENDSTYLE
END
-RUN
 
Report This Post
Gold member
posted Hide Post
WOW Pietro, you are a genious!

I tried this and it works great provided if the user enters the part of the text as it is. I mean this code is working only if the user enters the correct case of the text. So, basically this code is case sensitive. What I have in the description is a mixed case. So, user might enter small letters or capital letters. In that case, it looks like this code does not work.

For example: in the description, I might have a name as : Suzy Smith

so if the user enter smith, this code does not work.

Thank you.
 
Posts: 76 | Registered: October 28, 2003Report This Post
Silver Member
posted Hide Post
you might want to check out UPCASE() or LOCASE()

hth,

drew
 
Posts: 46 | Location: San Francisco, California | Registered: April 14, 2003Report This Post
<Pietro De Santis>
posted
Here is the program taking into account the case of the search string and the string to be searched.

-SET &ECHO=ALL;

-DEFAULT &STRING2 = 'tHe';

-SET &STRING2LO = LOCASE(&STRING2.LENGTH, &STRING2, 'A&STRING2.LENGTH');

TABLE FILE MOVIES
PRINT
TITLE
-* Create Lower-case version of string
COMPUTE STRING1LO/A39 = LOCASE(39, TITLE, STRING1LO); NOPRINT
-* Compute String Length
COMPUTE STRING1_LEN/I4 =
ARGLEN(39, TITLE, 'I4'); NOPRINT
-* Replace Space char by ^ char
COMPUTE STRING1/A39 =
CTRAN(STRING1_LEN, TITLE, 32, 94, STRING1); NOPRINT
-* Determine position of search string
COMPUTE POS_STRING2/I3 =
POSIT(STRING1LO, 39, '&STRING2LO', &STRING2.LENGTH, 'I4'); NOPRINT
-* Extract text from beginning to before search string
COMPUTE BEG_STRING1/A39 =
SUBSTR(39, STRING1, 1, POS_STRING2-1, 39, BEG_STRING1); NOPRINT
-* Extract text that matches search string
COMPUTE MAT_STRING1/A39 =
SUBSTR(39, STRING1, POS_STRING2, POS_STRING2+&STRING2.LENGTH, 39, MAT_STRING1); NOPRINT
-* Extract text from after search string to end
COMPUTE END_STRING1/A39 =
SUBSTR(39, STRING1, POS_STRING2+&STRING2.LENGTH, 39, 39, 'A39'); NOPRINT
-* Create new string including styling
COMPUTE STRING3/A200 =
BEG_STRING1 || '<font color="blue">' || MAT_STRING1 || '</font>' || END_STRING1; NOPRINT
-* Replace ^ char by space char
COMPUTE STRING4/A200 =
CTRAN(200, STRING3, 94, 32, STRING4);
BY CATEGORY
WHERE LOCASE(39, TITLE, 'A39') CONTAINS '&STRING2LO'

ON TABLE SET PAGE NOLEAD
ON TABLE SET STYLESHEET *
TYPE=REPORT, GRID=OFF, FONT='VERDANA', SIZE=8, $
ENDSTYLE
END
-RUN
 
Report This Post
Virtuoso
posted Hide Post
I'm not sure why character conversion is called for here, but anyway...

Instead of coding integer values for the From/To character arguments of CTRAN,
I prefer to code the characters explicitly, and let BYTVAL do the conversion.


DEFINE FILE CAR
TRANS/A10=CTRAN(10, COUNTRY, BYTVAL(' ','I3'), BYTVAL('^','I3'), 'A10');
END
TABLE FILE CAR
PRINT TRANS BY COUNTRY
END
Portable (no Ascii/Ebcdic dependencies), less error-prone, more maintainable.

This message has been edited. Last edited by: <Mabel>,
 
Posts: 1925 | Location: NYC | In FOCUS since 1983 | Registered: January 11, 2005Report This Post
<Pietro De Santis>
posted
Thank you for the BYTVAL tip, always wondered what it could be used for.

The reason there's character conversion in my example is that there may be embedded blanks in the text where a string is to be coloured differently. I do not want to lose any blank characters just before and just after the string to be coloured, eg:

Wag <font color=red>The</font> Dog

or

E<font color=red>the</font>real Wonder

That program again, with the BYTVAL function:

-SET &ECHO=OFF;
SET MSG=OFF
-RUN

-DEFAULT &STRING2 = 'tHe';

-SET &STRING2LO = LOCASE(&STRING2.LENGTH, &STRING2, 'A&STRING2.LENGTH');

TABLE FILE MOVIES
PRINT
TITLE
-* Create Lower-case version of string
COMPUTE STRING1LO/A39 = LOCASE(39, TITLE, STRING1LO); NOPRINT
-* Compute String Length
COMPUTE STRING1_LEN/I4 =
ARGLEN(39, TITLE, 'I4'); NOPRINT
-* Replace Space char by ^ char
COMPUTE STRING1/A39 =
-* CTRAN(STRING1_LEN, TITLE, 32, 94, STRING1); NOPRINT
CTRAN(STRING1_LEN, TITLE, BYTVAL(' ','I3'), BYTVAL('^','I3'), STRING1); NOPRINT
-* Determine position of search string
COMPUTE POS_STRING2/I3 =
POSIT(STRING1LO, 39, '&STRING2LO', &STRING2.LENGTH, 'I4'); NOPRINT
-* Extract text from beginning to before search string
COMPUTE BEG_STRING1/A39 =
SUBSTR(39, STRING1, 1, POS_STRING2-1, 39, BEG_STRING1); NOPRINT
-* Extract text that matches search string
COMPUTE MAT_STRING1/A39 =
SUBSTR(39, STRING1, POS_STRING2, POS_STRING2+&STRING2.LENGTH, 39, MAT_STRING1); NOPRINT
-* Extract text from after search string to end
COMPUTE END_STRING1/A39 =
SUBSTR(39, STRING1, POS_STRING2+&STRING2.LENGTH, 39, 39, 'A39'); NOPRINT
-* Create new string including styling
COMPUTE STRING3/A200 =
BEG_STRING1 || '<font color="blue">' || MAT_STRING1 || '</font>' || END_STRING1; NOPRINT
-* Replace ^ char by space char
COMPUTE STRING4/A200 =
-* CTRAN(200, STRING3, 94, 32, STRING4);
CTRAN(200, STRING3, BYTVAL('^','I3'), BYTVAL(' ','I3'), STRING4);
BY CATEGORY
WHERE LOCASE(39, TITLE, 'A39') CONTAINS '&STRING2LO'

ON TABLE SET PAGE NOLEAD
ON TABLE SET STYLESHEET *
TYPE=REPORT, GRID=OFF, FONT='VERDANA', SIZE=8, $
ENDSTYLE
END
-RUN
 
Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic


Copyright © 1996-2020 Information Builders