Beyond Compare
by Mike Midas, Ace Developer
The day stretched out before me like the Great Wall of China, a thousand miles of mind numbing boredom, and me hell-bent on refusing to take that first step. That is, until the door opened and in walked a vision straight out of Mao's Little Black Book (the one he didn't publish). She was petite, if by petite you meant 5'2" and stacked like a couple dozen jets over Beijing, and she had a mysterious smile that would have made the Mona Lisa pack her bags and head home to Momma Mia. It was like a ray of sunshine came in the window, poured me a drink and started doing the Lion Dance with my heart.
"May I help you?" I asked, and the unspoken words in my question would have made a sailor blush.
"Sir!" she spoke, and her voice carried more than a hint that I could take a long march off a short pier. "I have a business need and my friend said you might be able to help."
I was in danger of getting whiplash from the rapid change in moods, but I pulled myself together enough to ask what the business need was. Despite the beating my heart was taking, my head told me I had a job to do.
"We have a Policies and Procedures manual that we have implemented in Lotus Notes, and it works well for workflow and approvals.", she went on. I just listened, because so far I had nothing to offer but a bruised ego and some day old bagels from Sam's deli on 7th and Grand.
"Our problem is that when a reviewer modifies the document, we can't easily tell what has happened. Some of these documents are quite long, and may have tables of data, and it is hard to see what has changed."
It wasn't hard for me to see that she had changed from a promising ray of sunshine into a fire breathing dragon, but I guessed that wasn't what she was talking about.
"We have been copying the documents into Microsoft Word so that we can compare them, but this is quite cumbersome, and there is a loss of data when doclinks or images are present. I have heard that perhaps your Midas Rich Text LSX could provide an answer, perhaps by letting us step through the text and find what has changed, then create a report about which paragraphs are the same and which are different. It would not be perfect, but it would help us know where to look for changes."
I laughed, and she started as if the laughter was directed at her. "We can do better than that," I said. "We can just do a rich text comparison with Midas and show you exactly what has been deleted, added or modified."
"I don't understand," she stammered, "but what would that look like? What kind of a comparison is it?"
I have to admit, I enjoyed her discomfort. Two can play at that game, although it isn't my favorite game that two can play at by a long shot. "Let me show you an example." I opened our standard Review It! sample database, as I wanted her to have a sample she could take back to the office. "Here is a rich text field with some text and a table."
Figure 1 - Original rich text before modifications
"Now, I'll make some changes, but don't watch. Let's see how many you can find." I quickly made some changes, both to the text before the table and to the tables itself, and even added a row with two merged cells at the bottom of the table. "OK, now you can look"
Figure 2 - Modified rich text without any markup
She looked closely at the modifications I had made, and she caught a few, but clearly was embarrassed that she could not find more. Quickly, I moved on. "Now, let's let Midas compare the fields and show us what the changed with red-lining."
Figure 3 - Modifications shown in an approver view, with deletions and modifications
Her eyes popped like a kid watching fireworks for the first time. "But... but... that is better than Microsoft Word. It even knew that there was a new row in the table, and it knew that a number with a decimal point was a number. How did you do that?"
I may not be David Copperfield, but I enjoyed the look of amazement as if I'd made up the trick myself. Then, suddenly, her eyes narrowed. "But what are we to do when we want to show the modified documents to our users? They will not want to see the deleted parts, and it looks like a great amount of work to remove all the clever strikethroughs."
Like any good card sharp, I let her think she had me for a moment, then pulled the old switcheroo on her. "No problem! That was the approver's comparison. For the public comparison, you just do... this!"
Figure 4 - Modifications shown in a public view, without deletions
She looked for a couple of minutes, and asked a couple of questions just to be clear, and then she smiled. It might not have seemed like much of a smile to somebody else peering in the window or glancing in the door, but I was pretty sure it was a great leap forward for my evening's prospects.
[NB: Dedicated to Mickey Spillane, a writer beyond compare, who died today at the age of 88.]
Copyright © 2006 Genii Software Ltd.