358 Lotus blogs updated hourly. Who will post next? Home | Downloads | Events | Pods | Blogs | Search | myPL | About 
 
Latest 7 Posts
Connect 2014 and me
Thu, Jan 9th 2014 78
$5 eBooks from Packt
Thu, Dec 19th 2013 69
Massive savings on over 1600 PACKT DRM-free eBooks and Videos
Thu, Oct 17th 2013 68
Lesson for the week: Always ask for a second opinion.
Fri, May 3rd 2013 76
Book Review: IBM Lotus Notes 8.5.3 How-to
Thu, Apr 25th 2013 69
All of a sudden I am living on lakefront property
Thu, Apr 18th 2013 70
Looking for a little help with Dojo dGrid
Tue, Mar 19th 2013 79
Top 10
Looking for a little help with Dojo dGrid
Tue, Mar 19th 2013 79
Connect 2014 and me
Thu, Jan 9th 2014 78
Lesson for the week: Always ask for a second opinion.
Fri, May 3rd 2013 76
All of a sudden I am living on lakefront property
Thu, Apr 18th 2013 70
Book Review: IBM Lotus Notes 8.5.3 How-to
Thu, Apr 25th 2013 69
$5 eBooks from Packt
Thu, Dec 19th 2013 69
Massive savings on over 1600 PACKT DRM-free eBooks and Videos
Thu, Oct 17th 2013 68
Google+ Hangout for those who were not at IBMConnect
Mon, Jan 28th 2013 67
Create stunning websites that work on any device with Responsive Web Design
Thu, Jan 31st 2013 64
Using XPages to develop complex reports
Thu, Feb 28th 2013 63


When all goes wrong, it is probably something you did
   

Russell Maher posted an interesting and timely tip today on his blog. I recommend that everyone take a moment to read it. This post was inspired by a conversation I had with Russ and Nathan Freeman last night.

I spent the better part of the last couple of days trying to figure out why Rich Text Fields, Attachments, and anything having to do with saving to an RTF on the backend wouldn't work in my XPage. Other times, different fields that worked once, stopped working at odd times too.


Everything pointed to a problem somewhere in some call in XPages. I tried the Rich Text Upload Control, the rich Text Control, Upload code found on OpenNTF and other places. In all, I think I tried over 8 different ways to get anything to save to my backend RTF.  The reason I say everything pointed to XPages was because everything else in the program worked as expected. It was only when I tried to do anything with an RTF that it would break.

After talking with Russ and Nathan last night I decided, thanks to Russ beating me over the head until I agreed, to take apart the entire page and see if even a single Rich Text Control would save to the RTF. So first thing this morning I made a complete copy of my application and started to pull it apart.

Now this wasn't easy, and I don't recommend anyone try it at home, because, in my case, there were 11 Custom Controls involved in this application. The Rendering of some Controls depended on fields on other ones so to do this right I had to gut the entire thing and start over almost from scratch.

I used a single Rich Text Control, bound it to the form and RTF and a button that did one thing - a Document Save. Okay that worked as it should. Step one proved at least to me that a Rich Text Control does indeed work. Good, it wasn't broken after all.

Next step was to start adding back in fields to see what happened and if one of them broke my code. I started off with one field and added it to the save button. Cool, first field added back and the RTF still worked.

Okay, now start adding back a group of fields. If I did it one at a time, I would still be adding them tonight. Ten fields added back, so far so good. No refreshes and no updates to the rendering of any Custom Controls yet so I was still holding my breath.

Two more Custom Controls added and all of a sudden it happened again. The RTF was not being updated? Okay, pull those two CCs back out and add the fields back one at a time from within them. Okay now everything seems to be working again even though those were the exact same fields from the exact CC that just broke it. Great, now I am even more confused.

Well since it was working again, I figure let's add in some more of the CCs and see how it goes. One CC of fields or labels or whatever at a time. Things seem to be going well now and that had me worried and for good reason. It stopped working again after adding in the 8th one. Okay, take all the code and drop it directly onto the XPage again and see if something shows up. Nope, still not working. Take all the code and add in the fields one at a time. Now it was working again.

Okay at this point I had essentially rebuilt the entire XPage with the exception of any Full or Partial Updates that updated the rendering of various fields. Time to copy in the code from the different fields and see what happens.

First field, good. Second field, good. All the fields are now back the way they were in the beginning, good. So what was left? As I rebuilt the page, I kept updating a copy of the original Save as Draft and Submit buttons. After everything was done I tried the Save as Draft button and it didn't work. Okay, back up one step. Let's take a real hard look at the code in that button and sure enough there it was - a single typo. I had used an uppercase letter in a Var definition and the one line of code that used that var later on had a lowercase letter instead.

Now, I don't know why this did not throw an error of any kind, it just seemed to skip over the problem line and appeared not complete the process (but it actually did sort of). The last line of that specific piece of code did a Save(), which worked for every other field except for the Rich Text Field. So instead of breaking and throwing an error, that line of code was just skipped and the process continued on with the next line of code.

What I find even more interesting was that no where in this code did I have anything pointing to the RTF or the various RT or Upload Controls. Everything else was saved and it ran as expected except the Rich Text updates. Why this caused the problem with a Rich Text Field I still do not know. I will leave that to smarter people than I to figure out.

The worst part of all this was that the line of code that had the typo was only used to set a viewScope variable that I never got around to using anyway. So after I spent over 40 hours trying to fix this problem it was all due to the difference between the cases of one letter in one variable in one Custom Control out of almost a dozen.

So what did I learn from all this? Spelling, and uppercase & lowercase mistakes will drive you mad and are very hard to find. If you find that something works sometimes and not other times and it makes no logical sense to you, it is time to start reading through your code from line one. I would even go so far as to copy and paste it into a text editor and search for every instance of every variable you created. Maybe do a Search & Replace on them just to be sure that when you read through it again, you might notice one of them looks out of place.

By the way, the line of code in my program that caused the problem was viewScope.put( "urICode", ......) instead of viewScope.get( "urlCode", .....).  How good are your eyes? Did you see the difference right away? Yes that was an "I" (uppercase eye) compared to "l" (lowercase ell). My 53 year old eyes didn't see that for 3 days and yes, I just got new glasses.



---------------------
http://rrumaner.blogspot.com/2012/01/when-all-goes-wrong-it-is-probably.html
Jan 25, 2012
42 hits



Recent Blog Posts
78


Connect 2014 and me
Thu, Jan 9th 2014 9:11a   Roy Rumaner
I will be at Connect 2014 doing demos at the NotesCode booth (#345) for a product called Mobilite. Stop by to see a demo or just to say hi. [read] Keywords:
69


$5 eBooks from Packt
Thu, Dec 19th 2013 4:19p   Roy Rumaner
Following on from the success of last year’s festive offer, Packt will be celebrating the holiday season this year with an even bigger $5 Bonanza. From December 19th, our customers will be able to get any eBook or Video from Packt for just $5.This includes our entire range of popular IBM eBooks as well . This offer covers every title in the 1700+ range and our readers can grab as many as they like until January 3rd 2014. For more information, please visit: http://bit.ly/1jdCr2W [read] Keywords: ibm
68


Massive savings on over 1600 PACKT DRM-free eBooks and Videos
Thu, Oct 17th 2013 8:12a   Roy Rumaner
Massive savings on over 1600 PACKT DRM-free eBooks and Videos 17th October 2013 50% OFF ALL eBOOKS AND VIDEOS - SHOP NOW COLUMBUS DAY – 50% off ALL eBooks and Videos at packtpub.com Due to popular demand, we're giving you a few more days to explore our range of eBooks and Videos at a massive 50% discount at packtpub.com – the sale will now end Monday. This offer is available on our entire range of eBooks and Videos and you can use the code as many times as you like until Mond [read] Keywords: application development linux python
76


Lesson for the week: Always ask for a second opinion.
Fri, May 3rd 2013 8:17a   Roy Rumaner
Lesson for the week: Always ask for a second opinion. This statement really hit home this week and it saved me a huge amount of money. On Monday morning, the engine in my wife's car died while she was on her way to work. No warning, no lights, no bells and whistles, just sitting at a light and bang, stutter and then nothing. Dead. Flash forward, I arrive to help her move it out of traffic and wait with her until AAA arrives to tow it to a repair shop a few miles away while I drive [read] Keywords:
69


Book Review: IBM Lotus Notes 8.5.3 How-to
Thu, Apr 25th 2013 3:17p   Roy Rumaner
IBM Lotus Notes 8.5.3 How-to While this is a very short (less than 60 pages) book, it tries to pack a lot of information into it. The chapters are set up as Simple, Intermediate and Advanced. This is nice in that anyone picking up the book can quickly find the topic and the level of experience needed to understand it. The Table of Contents list out the chapters as Customizing your IBM Lotus Notes 8.5.3 experience (Simple) Mastering your Lotus Notes mail (Int [read] Keywords: domino ibm lotus notes notes client sametime applications integration microsoft outlook widgets workspace
70


All of a sudden I am living on lakefront property
Thu, Apr 18th 2013 10:16a   Roy Rumaner
The first two picture are from yesterday about 4 hours after the rain started. Not to bad out back and the usual small ponds around the storm drains in front. Today, after almost 12 hours of very intense thunderstorms, we now have a lake instead of small ponds and the backyard is completely under water. After about two hours with light rain this morning, the storm sewer in the backyard did it's job and the backyard is quickly draining out. (Ignore my finger, I am still try [read] Keywords: blogger gadget




79


Looking for a little help with Dojo dGrid
Tue, Mar 19th 2013 9:17p   Roy Rumaner
I am trying to use the new Dojo dTuned dGrid in an XPages application and cannot seem to get it to work. The documentation is spotty at best and I am not up on Dojo and GIT as much as I need to be right now. I am sure someone has already done this and I am hoping I can impose on you to give me a little help getting it working. Send me an email or leave a comment on here if you are able to help me. Thank you [read] Keywords: xpages application dojo email
46


Using XPages to develop complex reports - Part 3
Tue, Mar 12th 2013 4:11p   Roy Rumaner
I recently wrote a three part blog about a project I did for my current client - TeamSpace Canada. Instead of repeating the entire series here, I am just going to post the links to the three parts as they are published. Using XPages to develop complex reports - Part 3 (posted 3/12/2013) [read] Keywords: xpages
45


Using XPages to develop complex reports - Part 2
Tue, Mar 5th 2013 2:18p   Roy Rumaner
I recently wrote a three part blog about a project I did for my current client - TeamSpace Canada. Instead of repeating the entire series here, I am just going to post the links to the three parts as they are published. Using XPages to develop complex reports - Part 2 (posted 3/5/2013) [read] Keywords: xpages
63


Using XPages to develop complex reports
Thu, Feb 28th 2013 10:10a   Roy Rumaner
I recently wrote a three part blog about a project I did for my current client - TeamSpace Canada. Instead of repeating the entire series here, I am just going to post the links to the three parts as they are published. Using XPages to develop complex reports - Part 1 (posted 2/28/2013) Using XPages to develop complex reports - Part 2 Using XPages to develop complex reports - Part 3 [read] Keywords: xpages




Created and Maintained by Yancy Lent - About - Blog Submission - Suggestions - Change Log - Blog Widget - Advertising - Mobile Edition