332 Lotus blogs updated hourly. Who will post next? Home | Downloads | Events | Jobs | Twitter | Bookmarks | Pods | Blogs | Search | myPL | About 
 
Latest 7 Posts
Lesson for the week: Always ask for a second opinion.
Fri, May 3rd 2013 156
Book Review: IBM Lotus Notes 8.5.3 How-to
Thu, Apr 25th 2013 198
All of a sudden I am living on lakefront property
Thu, Apr 18th 2013 218
Looking for a little help with Dojo dGrid
Tue, Mar 19th 2013 105
Using XPages to develop complex reports - Part 3
Tue, Mar 12th 2013 109
Using XPages to develop complex reports - Part 2
Tue, Mar 5th 2013 154
Using XPages to develop complex reports
Thu, Feb 28th 2013 125
Top 10
Packt Publishing reaches 1000 IT titles and celebrates with an open invitation
Wed, Sep 19th 2012 222
All of a sudden I am living on lakefront property
Thu, Apr 18th 2013 218
Book Review: IBM Lotus Notes 8.5.3 How-to
Thu, Apr 25th 2013 198
Lesson for the week: Always ask for a second opinion.
Fri, May 3rd 2013 156
Using XPages to develop complex reports - Part 2
Tue, Mar 5th 2013 154
Create stunning websites that work on any device with Responsive Web Design
Thu, Jan 31st 2013 145
Chros Toohey and friends weekly Google+ Hangout listing
Wed, Feb 6th 2013 127
Xpage navigationRules do not work as expected - here is a workaround
Mon, Jul 25th 2011 125
Using XPages to develop complex reports
Thu, Feb 28th 2013 125
Book Review: IBM Lotus Domino:Classic Web Application Development Techniques
Mon, Aug 8th 2011 114


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
97 hits



Recent Blog Posts
156


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:
198


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
218


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
105


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
109


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
154


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




125


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
127


Chros Toohey and friends weekly Google+ Hangout listing
Wed, Feb 6th 2013 11:10a   Roy Rumaner
Chris Toohey is putting together a series of Google+ Hangouts and has asked me be on the panel each week. We will be discussing different topics every week so you can pick and choose which one(s) you want to watch. This post will contain all the links to all the Hangouts I am involved in. Wednesday 2/6/2013 - Gamification and Color Profiling (Chris Toohey, Chris Warden, Monica Ferrante, Roy Rumaner) [read] Keywords: google
145


Create stunning websites that work on any device with Responsive Web Design
Thu, Jan 31st 2013 12:11p   Roy Rumaner
Create stunning websites that work on any device with Responsive Web Design Build once, browse anywhere with the help of Packt’s responsive web design books, along with 20%-50% off. With an increasing amount of devices entering the market, your audience is consuming media like never before across multiple formats and resolutions. Our books will help you embrace Responsive Web Design so you can showcase your content without having to worry about a mobile browser or the resolut [read] Keywords: citrix development email javascript mobile twitter
107


Google+ Hangout for those who were not at IBMConnect
Mon, Jan 28th 2013 12:12p   Roy Rumaner
Thank you to Chris Toohey for setting up a week of Google+ Hangouts for those that didn't get to go to IBMConnect (also known as Lotusphere 2013). I was happy to participate in the Hangout and because Google+ records everything, Chris posted it on YouTube for everyone else to see. I am posting links to all of them so that everyone who reads this blog can find them easily. Monday - Getting started with IBM XPages http://youtu.be/9r-KMk7WDcc Tuesday Wednesday Thursday Friday [read] Keywords: ibm lotusphere xpages google




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