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] Compare and highlight string differences

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] Compare and highlight string differences
 Login/Join
 
Platinum Member
posted
Hi All,

I'd like to compare 2 string fields on a record and highlight the difference between them if a difference exists. Ideally, I'd display the 2 fields on the row with a 3rd field that shows the string and the offending character formatted with color. Another option would be to indicate the integer position where they diverge so the user could count from the beginning of the string. Identical string lengths with transposed characters are especially tricky to spot the differences.

Any ideas? WebFOCUS, jQuery, or javascript ideas are all welcome.

Thanks,

Norb

This message has been edited. Last edited by: Norb Eckert,


prod:7.6.9, win2k3 mre, caster, bid, devstudio 7.6.9
 
Posts: 242 | Location: Minneapolis | Registered: February 16, 2006Report This Post
Virtuoso
posted Hide Post
Possible WebFOCUS solution:

DEFINE FILE CAR
 STRING1/A25 WITH COUNTRY    = 'a1b2c3d4e5f6g7h8i9j0';
 STRING2/A25 WITH COUNTRY    = 'alb2c3d4E5f6g7h8i9jO';
 DIFF_FLAG/A9                = IF (STRING1 EQ STRING2) THEN 'Same' ELSE 'Different';
 STR2_OUT/A120V WITH COUNTRY = '';
-REPEAT :ENDREPEAT1 FOR &I FROM 1 TO 25
 STR1_CHAR/A1 = SUBSTR(25,STRING1,&I,&I,1,'A1');
 STR2_CHAR/A1 = SUBSTR(25,STRING2,&I,&I,1,'A1');
 STR2_OUT     = IF (STR1_CHAR EQ STR2_CHAR) THEN (STR2_OUT || STR2_CHAR)
                ELSE (STR2_OUT || '<b><font color=red>' || STR2_CHAR || '</font></b>');
-:ENDREPEAT1
END
-*
TABLE FILE CAR
 PRINT STRING1 STRING2 STR2_OUT DIFF_FLAG
 WHERE RECORDLIMIT EQ 1 ;
END


EDIT: Added the '/' to the closing bold tag, which was missing.

This message has been edited. Last edited by: Dan Satchell,


WebFOCUS 7.7.05
 
Posts: 1213 | Location: Seattle, Washington - USA | Registered: October 22, 2007Report This Post
Platinum Member
posted Hide Post
Dan - OMG!!!!! That's awesome. This is going to work very well.

There's gonna be a little something extra for you in your check this week! Wink

Thanks,

Norb


prod:7.6.9, win2k3 mre, caster, bid, devstudio 7.6.9
 
Posts: 242 | Location: Minneapolis | Registered: February 16, 2006Report This Post
Virtuoso
posted Hide Post
Just remember that your output field (STR2_OUT in my example) must be large enough to contain all of the extra characters generated by the addition of the bold and font color tags - 30 characters are added to the output string every time there is a difference.


WebFOCUS 7.7.05
 
Posts: 1213 | Location: Seattle, Washington - USA | Registered: October 22, 2007Report This Post
Platinum Member
posted Hide Post
Dan,

Just wanted to let you know that I added a variant of your code to a fex that runs hourly each day and it worked beautifully to highlight the string differences. The users are squealing with delight! I told them I couldn't have done it without this forum and you. Cool

Thanks,

Norb


prod:7.6.9, win2k3 mre, caster, bid, devstudio 7.6.9
 
Posts: 242 | Location: Minneapolis | Registered: February 16, 2006Report This Post
Virtuoso
posted Hide Post
Norb,

Thanks for the kind words. This forum is a treasure, even if we can't attach sound byte squeals of delight to the posts...yet. Big Grin


WebFOCUS 7.7.05
 
Posts: 1213 | Location: Seattle, Washington - USA | Registered: October 22, 2007Report 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] Compare and highlight string differences

Copyright © 1996-2020 Information Builders