Wednesday, April 21, 2010

My escapades in Xpages in which I ...code? sorta

This is for all the admins and developers who have yet to work with XPages.

Many readers know I am not a developer, although decades ago I was. You may recall this post which was highly popular at the time when I discussed how hard it was to code in Designer 8.5 or I should say what worked or didn't work for me.

At the time I did not even touch XPages.

My how times change, we still do not employ a developer in house, we hire as project requires, so guess who gets to play developer!

So for our LCTY's I needed a database for registration and information setup, easy I say, I got some hundred templates and stuff, must be something I could reuse. Famous last words!

If you have been following me on Twitter, you will know I have been playing with PHP usage and Domino(post coming if/when I get it working) and the last few days providing excellent humor to the greater community, right Darren, while I query basic items that should be simple to do in the Designer client but are nowhere to be found.

I asked around, not with much luck, and some cryptic coding references. Chris Toohey Blogger of the Year for his great efforts, was helpful in 2 key points which made a world of difference for me.

But let's start simple.

1) Getting started page of Designer which most people click away has some basic, really basic information. You can see it by clicking on help from Designer and Click on Welcome.

2) From the Welcome screen, now click on What's New. Scroll down to Learn more and you will seek the "howto" for XPages from the help. So click on XPages Tutorial which takes you to the Help guide and the XPages tutorial, which for me was not written for a new developer. If I had more time I would have followed it all, but I learn on the fly and by necessity. Don't follow me, follow the tutorial, it is pretty good with pictures and details, although you would be better served if you were a developer already IMHO.

3) Now, if you are with me this far, I suggest you take a look at some blog posts from David Leedy that helped me with some basics that I was missing. Thanks again David!

4) If you have any interest in XPages, you must start with Declan Lynch's (definitive?) blog posts on XPages, not as helpful for me short term this time but great references.

5) Chris Toohey pointed out some items which a new developer might not know and that is you may not see your control sets or data in the right hand column of your Designer client. Control sets provide the great drop down of all the items available for usage which we all know and love like checkbox, fields, links, radio buttons. This is important because they are drag and drop and easy to use, if you know hwo to work with them. And the second reason this column is important is because once you create your Notes regular form and fields, there is a 2nd tab for data which once you tell it where to find the details allows you to drag and drop all the fields onto your new XPages form. And they are done. So cool! But for whatever reason they did not show up on my screen. To see it, when you have your application/database open in Designer go to Window on the Menu bar and then Reset Perspective and click Yes when it asks to reset to defaults. Later on you will understand more about it, if you stick with this.

So that's the basics. Perhaps in another post I will detail how i put the site together. Suffice it to say I used a mix of html pages and a notes app.

Now, what were my problems?

1) RTFM applies to me in this case, but since there is no really good manual or help file that lets me ask in normal English what is in Eclipse/XPages language this caused me some issues.

2) Emailing your form/document. Prime example of my queries that went nowhere, as I just said in #1. Nothing to explain how to do this, no control set either. You have to build it. Bad, I say, just Bad. You can have a control for links but not a mailto option type control? I chalk this one up to my lack of education but if you can "submit" a form, you should be able to have the option to submit and email.

3) Lots of options for everything, but if you don't get your data linked properly, it won't work. Error reporting, even when enabled, leaves a lot to be desired.

4) XML is not HTML. Fine I accept that. But provide a basic, here is how you would add something in html and this is what it looks like in XML. Note the changes, now go code. I found some sites on the net that helped but don't have the links. Sorry.

5) I might be out of line here, but a default view should be created on the fly with whatever information is in one's form (notes or XPages). Ok, maybe this is just a dream, but why do I still have to create a basic view like I did 20 years ago? By hand?!

Eventually I did manage to get the XML side a little and edit in the source page to fix some things. But if you never coded html or understand how to read code, you may find yourself confused at first.

A great learning experience and makes me want to understand more about XPages and see the fruits of my labor more often, but I also know I am really not a developer, and never claim to be one.

Bottom line is yes you can build it, if you have patience, time, the internet, books, manuals and great friends to help you online, IM, skype, phone or email.