Any good sample coding for view column title to be dynamic

I would appreciate if any one can share me how to do this in notes client:

The year in the title column is 2006 when view this year. It will appear as 2007 if view next year.

Any helps are really appreciated.

Subject: Any good sample coding for view column title to be dynamic

I would prefer to run an agent that goes into these views on the first of every month and if it’s Jan1 then it changes the view titles. I think any dynamic solution is going to be too expensive in terms of performance.

regards,

raphael

Subject: RE: Any good sample coding for view column title to be dynamic

Can you please share me any coding you have done so far? I understand that view column title change was impossible in earlier version?

Subject: Any good sample coding for view column title to be dynamic

Here’s a fragment of code that will do what you want. This sets the first column title to “New Title”.

dim sess as new notessession

    dim db as notesdatabase



Dim view As NotesView ' The view you want to change

Dim vca As Variant

    dim columnNo as integer

    dim titleText as string



set db = sess.currentdatabase

Set view = db.GetView("ViewName")



    columnNo = 0

    titleText = "New Title"



    ' Load all the columns into the variant

vca = view.Columns



vca(columnNo).Title = titleText

The best way, IMHO to implement this, is to have the code in an agent as suggested by others. You could either run it in the QueryOpen event or by scheduling it. If it’s inline code in the QueryOpen event, the user will probably need designer access, which you probably do not want to grant to users :slight_smile:

Subject: RE: Any good sample coding for view column title to be dynamic

tq, will test it… really appreciates that, I am bit slow in lotus script, as I weren’t able to attend any such training, and can’t find any good books in my country on Lotus script for beginners. May try to learn how to program via agent in future.