Configurable low overhead scheme for date dependent colour coding in views

It is useful to have colour coding of target dates in views but in traditional Notes applications ( as opposed to XPages ) this carries a big overhead if you do the date calculation in the actual column using @today etc.

Also see Steve McDonagh’s post on colour blindness. You could also use this approach for icons.

Image:Configurable low overhead scheme for date dependent colour coding in views

This scheme uses a scheduled agent to replace the column formula each night with a hard coded date. It runs on 120 views in less than 1 second.

The scheme also uses a configuration document for the formula so that super users can update the threshold values.

There are 3 parts to consider :

1) the column formula. The image below shows it in the configuration document.

The bits in yellow are the constructors that are used to insert the relevant dates for the banding.
In this case
> 5 days away is neutral
0 – 5 days is yellow
overdue = red

Image:Configurable low overhead scheme for date dependent colour coding in views

2) The column in the view.

This column is hidden and has the property “Use value as colour”.  This title of this column must start AGENTLINKED so that the scheduled agent can pick it up and modify it ( see below )
There must also be another column to turn the colour off again. The value of the formula after the agent has run is shown below – you can leave it blank and then run the agent to populate it.

Image:Configurable low overhead scheme for date dependent colour coding in views

Image:Configurable low overhead scheme for date dependent colour coding in views

3) The Scheduled Agent

The scheduled agent loops through every view and every column within each of those views.
Where it finds a column with he AGENTLINKED string in the title it tries to update this.

When updating it :

1) extracts the relevant configurable formula string from the configuration document shown above. You can have multiple configuration documents  in case you need different target thresholds for different views etc..

2) it replaces the [#n#] with a date which is n days from now

3) it inserts the modified formula into the column as shown above.

Sub Initialize
     
     ‘ Sean Cull, FoCul Ltd.
     ‘ Released under Apache 2.0
     ‘ The purpose of this agent is to modify the column formula
     ‘ for columns so that dates can be highlighted as they become overdue.
     ‘ the column title will need to start with the phrase “.AGENTLINKED”
     ‘ e.g .AGENTLINKED : Colour_on_001
     ‘ this is then used for the keyword document that contains the formula.
     ‘ in the keyword document date increments are notated byu [#x#] where x
     ‘ is the number of days from today.
     ‘ e.g  @If ( target_date_dt > [#3#]; bgd:Dark_Blue ; ……..
     ‘ full example : red := 255:0:0; blue := 0:0:255; green := 0:255:0; gold := 255:128:0; black :=0:0:0; white := 255:255:255 ; yellow:= 255:255:0; bgd := 224:241:255 ; Dark_Blue := 0:0:128; @If ( target_date_dt > [#3#]; bgd:Dark_Blue ; target_date_dt >= [#0#];yellow:black; target_date_dt < [#0#];red:white; -1:-1:-1)
     
     Dim session As New NotesSession
     Dim rightNow As New NotesDateTime(Now)
     Dim db As NotesDatabase
     Dim configview As NotesView
     
     Set db = session.CurrentDatabase
     Set configview = db.GetView(“vlukeywords”)
     ForAll v In db.Views
             ForAll vc In v.columns
                     If InStr(vc.Title,“AGENTLINKED”)>0 Then
                             Call process_column(vc,configview)
                     End If
             End ForAll
     End ForAll
     
End
Sub
Sub
process_column(vc As NotesViewColumn, configview As NotesView)
     
     Dim configdoc As NotesDocument
     Dim strvar As String
     Dim strvar2 As String
     Dim pos As Integer
     Dim pos2 As Integer
     Dim incrementstr As String
     Dim datestr As String
     Dim dt As New NotesDateTime(“Today”)
     Dim z As Integer
     
     Set configdoc = configview.GetDocumentByKey(“.” + vc.Title )
     
     If configdoc Is Nothing Then
             MsgBox ” could not find configuration key .” + vc.Title
             Exit Sub
     End If
     
     strvar = configdoc.KeywordList_tx(0)
     
     pos = InStr< /strong>(strvar,“[#”)
     Do While pos > 0
             Call dt.SetNow
             strvar2 = Right(strvar,Len(strvar)-(pos+1))                
             pos2 = InStr(strvar2,“#]”)
             If pos2 = 0 Then
                     MsgBox “Error, did not find closing #] in column formula”
                     Exit Sub
             End If
             incrementstr = Left(strvar2,pos2-1)
             Call  dt.AdjustDay( CInt(incrementstr))
             datestr = “[” +  CStr(dt.DateOnly) + “]”
             strvar = Replace(strvar,“[#” + incrementstr + “#]”, datestr)
             pos = InStr(strvar,“[#”)
             
     Loop
     
     vc.Formula = strvar                        
     
End
Sub

So how do you open an xpage in a different database in XPINC ?


Image:So how do you open an xpage in a different database in XPINC ?

I have spent a large chunk of the weekend and tonight trying to make a suite of XPages applications work in both XPINC and the browser.

I’m still confused

How it works when everything is in the same database

If you want to open a document from a repeat when it is from the same database the recommended method is to use Open Page simple action using parameters and it works really well for both browser and XPiNC and is also helpful in that it is a put request rather than a GET request ( Mastering XPages page 658 ) – apologies to Tony McGuckin who I promised I would blog this 9 months ago.

Image:So how do you open an xpage in a different database in XPINC ?

Image:So how do you open an xpage in a different database in XPINC ?

The problem with data sources from other Notes databases

OK, so XPages is all about consolidating the presentation of multiple data sources in one place.

How then do you open a document from another database via a repeat ?

The crux here is that the dialogue above only presents “XPage” choices for the current database and there is no way of computing the other database – so you cannot use the simple action method.

Well for the browser you construct a URL, that is pretty straight forward. But what do you do for XPiNC ?

There are 3 methods which I believe should work although I have found that 2 are very flaky for me.

1) You can modify the underlying form associated with the XPage so that if the document is called then it will automatically be presented as the relevant XPage

To do this you would use a URL like this :

notes://server as common name/0/universalid

The downside to this is that where I work our “Best Practice”  is to be able to open the back end forms as native Notes forms for administration and troubleshooting – it is a very powerful tool.

I also have some suspicions as to whether the specified server is honored in this scenario.

So all in all not a good option.

2) You could call the XPage using the following construct

notes://server as common name/dp replica id/xp_f_document.xsp?openXPage&action=readDocument&documentId=8E800DB89E9E144A80257968004CDEE4

This should work although case sensitivity may be at play on our linux server – its hard to tell sometimes as daft as that sounds.

This method only works on 2/3 of my documents. I have eliminated issues with the logic on the XPage being the cause by using a very simple XPage with no improvement

So all in all not a viable option.

3) You could use a non rendering XPage with a “before render” script to redirect to the correct document.

This would be in the target database but might be more than 2/3 reliable. This would be a pure frig but I am tempted.

Again, not a great choice.

Some Observations

I have been on a real high with XPages of late and we have been doing some great stuff which I hope to share soon. But this project is dual XPINC and Browser.

Just at the moment I am beat – this feels like the dark days of XPages 8.5.0 and 8.5.1 – spending hours and days getting nowhere and feeling like you are the first to try something and find it lacking.

If XPINC is to be a first class client and if IBM is to deliver the vision of code once deliver on many platforms ( which is so so close based on my recent experience )  then XPINC needs to get more exposure inside IBM.

It simply wasn’t usable in 8.5.2 but is much better in 8.5.3. Darren Duke once said that he would know XPages was here to stay when the mail client was in XPages – in my opinion that would make a big difference in flushing out the issues.

Come on IBM, drink your own XPages champagne.

I am very honoured to be an IBM Champion

Warning, long and rambling post ahead.

Its been almost a week now since IBM made me an IBM Champion for IBM Collaborative Solutions and it is just beginning to sink in. It is a fantastic honour and I am very humbled by it. I am a huge fan of Notes and XPages and am very impressed with what IBM has given us in terms of both the platform and their very significant contributions to OpenNTF.

I started with Notes in 1995 and have been blogging since 2008. I find blogging and commenting on Notes a difficult balance. When you are so passionate about something it can be very frustrating when you feel that it could be even better. It is my nature, and my professional background, that I always push for things to be better than they are, sometimes that is seen as a negative but at other times people appreciate the feedback. Sometimes I still get it wrong and am too flippant with my comments.

To be honest receiving the award did make me stop and think if I should be more “positive”. It coincided with a great experience of Notes with a customer which reminded me how powerful Notes is and also the experience of installing and using Notes on a brand new MAC.  The Notes on MAC experience was not so good.

Having thought about it a bit more I have decided that I should just be “me” but I should make more of an effort to take the time to tell my story about how I see Notes ( and IBMs wider collaboration solutions ) helping businesses manage costs, processes and knowledge but at the same time not to shirk away from saying what needs to be better too.

It has been a frustration of mine for some time that not enough is said about the huge value that the IBM collaboration solutions add to businesses around the world every day. Most of us who work with Notes are proud to be Geeks and we want to see the demos at the OGS ( remotely in my case unfortunately ) but the reality is that if Business Leaders do not understand what the IBM platform ( that they often already have ) can deliver then there will be no install base for us to deliver to. I guess it is for that reason that LotuSphere has become LotuSphere + Connect.

It will also be interesting to see how IBM positions XPages. I am an applications person at the end of the day. I can see that Connections and other Social collaborations tools will become increasingly important but a lot of business is about structured collaborative processes. Many of these processes are “sub enterprise” and at the departmental or site level – this is where, in my view, Notes and XPages are at their strongest. There is still no other application platform that can plug these sub enterprise collaborative requirements as well as Notes. I think that IBM lost sight of this and Microsoft won the email battle even though the war was about much more than email.

Which brings us to XPages. XPages has been revolutionary in terms of improving the solutions that we have been able to deliver. At work we are flat out building our XPage skills and delivering some fantastic applications. We only have a relatively small set of loyal customers and as a business owner I feared that we had reached saturation by having done all of the obvious things with Notes. XPages has totally changed that with customers who are on 853 and those who see value in bringing their own customers into their collaborative processes via the browser. About 30% of our work over the last year has also been with net new customers who don’t have “Notes”.

Being totally honest I have never quite understood why IBM gave us XPages. Don’t get me wrong I will be eternally grateful that they did but it did seem to come out of the blue. I’m guessing here but I suspect that its success took some at IBM by surprise. Long before XPages an IBMer said to me – “Nothing in IBM is allowed to be a failure – it gets recycled into a success” – XPages is certainly a success. The next question is how does IBM position it ?

I understand that “Social” is important and that it is a wave worth riding but I can’t be the only one who is uncomfortable with the “Social” label – actually I know that I am not because my mainly industrial customers are uncomfortable with that label too. They are all for collaboration but their main need is for structured workflow and knowledge management processes  that deliver and demonstrate control of processes and knowledge. Having said that Activity Streams have huge potential and IBM is delivering tools to integrate XPages with Connections for just that reason.

How would I like to see IBM position XPages ?

I have heard IBM describe XPages as the “framework for building collaborative social business applications” – that is much to narrow.

XPages will certainly be a great platform to build the structured business process that will follow and compliment the more free form Social processes but it is not just about social.

I have no idea if it is technically feasible but I hope to see XPages in WebSphere and on every other IBM platform. I would love to see IBM throw their weight behind it as “the” IBM collaborative development platform. By all means leverage the “Social” buzz but also recognise that there is a demand for collaborative applications from people who do not see their need as “social” or who, and perhaps I am one of them, misunderstand what IBM means by social.

Actually I do think I understand what IBM means by Social – its essentially people working together – which is what collaboration is – but I still find the label uncomfortable and my customers even more so.

Anyway, I have rambled on even more than ever, and probably caused a few IBM people to wonder why I was made a champion. I am very pleased that they did make me a champion and I am looking forward to telling all who will listen ( I’m impressed if anyone still listening now ! ) as many good business success stories around IBM collaboration as I can find.