Comparing text in Interactive Report Columns (Template Component Plugin)

Early this year, someone asked me for a way to compare the text selected from two columns of a report and show de differences highlighted in colors.

I looked for the easiest way to accomplish this requirement and found a cool library to do it, htmdiff-js. This Library contains a function that receives as parameters two strings and returns an HTML with <ins> and <del> tags to highlight the differences between those strings.

After testing, I realized that by adding this library and some code to implement it in a report, the requirement could be done. But, APEX is about low coding, so why not try to put this in a plugin and make life easier?

And that's what I did. The plugin is available here in apex.world and it's really simple to use.

  1. import it into your application

  2. select the column in the report where you want to do the comparison

  3. In the Column Properties, Under Identification, select "Text Compare" as the Type

  4. Under Settings, select 3 columns:

    a. Base text: This should be the column with the original text

    b. New Text: The column holding the text you want to compare with the base one

    c. Unique Identifier: A column containing an ID or any identifier for the row.

That's it, your report is ready to work.

This is the first version of a simple solution. Hope to publish new versions with any possible improvements soon.