What a Difference a Decimal Place Makes! Or, How I Learned More About Math Than I Wanted To - Hilary Stoupa
in

InfoPath Dev

Hilary Stoupa

What a Difference a Decimal Place Makes! Or, How I Learned More About Math Than I Wanted To

The problem seemed like it would have an obvious answer. I had an XML that had been digitally signed when the InfoPath template was opened in the browser, but that could not be opened with the same form in the client. The helpful error message said:
Error Message

Simple, right? It seemed that the browser / client thing was probably a distraction -- something easily explainable. I took the template and quickly disabled all the data connections and all the rules. I figured if no rules were executing, nothing would be getting changed. Turning off the data connections should prevent any default values that used secondary data to get updated. As an aside - should you ever need to do such a thing to troubleshoot, first save your template as source files (the usual disclaimers apply) and then open manifest.xsf in a text editor. For those pesky data connections, use Find and Replace to change initOnLoad="yes" to initOnLoad="no". To disable rules quickly, change isEnabled="yes" to isEnabled="no". Use Replace All at your own risk.

That should do it, right? I had the problem XML saved locally, and set it as my preview data, and went to preview my form. Same error. Now what?

Well, obviously, something must be changing. After removing signatures from the XML (which could only be opened in the browser, mind you), I opened it with the client, and saved off the XML. Using a diffing tool, I compared the two XML. Obviously there were going to be some differences -- the processing-instructions, one was signed, one wasn't... but what most caught my eye were differences in the XML markup itself:
diffing

Self closing empty tags from the browser XML.

Looking further at the highlighted differences, I also saw one difference from what appeared to be encoding:
apostrophe
from the browser, and
totally NOT an apostrophe
from the client. One is an apostrophe. I remain uncertain as to what the other is.

These were red herrings, my friends. And while I'd love to build up a great deal of suspense to draw you further into my tale of woe, instead, I am just going to tell you what caused the issue.

Division. My old nemesis long division. Apparently browser and client forms don't agree about the number of decimal places. I'd not looked any further at default values, because I'd disabled the secondary data connections. It never occurred to me that a default value based on values in the main data source XML could possibly be different between XML saved in the browser and XML saved in the client. I was so very very wrong.

Here's the browser value:
4.03571428571429

Here's the client:
4.035714285714286

What makes it all the worse? This difference was highlighted by my diffing tool -- but I was so distracted by all the other highlights (the surrounding differences in the XML tags) that I didn't even notice it.

Wouldn't be a story without a moral. Here's what I learned -- I need to be a lot faster to dump my initial assumptions when I'm having issues figuring out a problem. Every time I thought about default values causing this, I brushed the thought aside, since I'd disabled those data connections.

And watch those default values -- especially in signed sections. The defaults were moved to rules instead, and now the signed XML can be opened in client or browser.

The Usual Disclaimers: If you are going to save your template as source files and do any of the risky and sometimes foolish things I suggest, particularly if you are planning on hitting the "Replace All" button, you really should make sure you've saved a copy first.

Comments

 

Patrick Halstead said:

Love it! Nothing ever is what it seems to be. And, we always have a "perspective" that gets in the way. Glad to know you're still open-minded enough to see the light. Must be all of that yoga you do. :) :) :)

January 30, 2011 5:56 PM
 

What a Difference a Decimal Place Makes! Or, How I Learned More About Math Than I Wanted To - Hilary Stoupa said:

Pingback from  What a Difference a Decimal Place Makes! Or, How I Learned More About Math Than I Wanted To - Hilary Stoupa

January 31, 2011 4:57 PM

About Hilary Stoupa

I wandered into development after working as a business process analyst for a global manufacturing company. I create InfoPath solutions for our clients as well as work as a developer on company tools that extend InfoPath. I've also been instrumental in creating the InfoPath Master Class training provided by Qdabra.

Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.