Search This Blog

Wednesday, May 8, 2013

Programmatic column name - strange behavior


Yesterday I noticed a very strange thing regarding programmatic column name I would like to share with you.

The story is simple.
I work on a big XPages application.
I noticed that some of the columns in my XPages views displayed unexpected values.
The important point here was that I manually assigned programmatic names for columns in Notes views.
I do not like to use automatically generated programmatic names because things like viewEntry.getColumnValue("$33") make solution less readable. So I set such names manually to self-descriptive values, like DocType, DocTitle, DocName etc.

Now we get to the most interesting part.
I discovered that if column formula uses a field name that also is used as a programmatic name for this column, then formula is completely ignored and column displays a pure field value without any changes you could make in a formula.

Check my screens

1) First I created a column with only a field name in a formula.
I also assigned the same programmatic name to this column.
Everything is OK

2) Then I changed the column formula.
Programmatic name was automatically changed by Notes.
It is OK also.

3) Then I set programmatic column name to the name of the field I used in the column formula.
It is not OK anymore.

Funny, right?

So I decided to add a dollar sign in the beginning of the programmatic name and it made me happy:
- I had readable column names in my XPages
- No more issues with column formulas

Environment: Window 7 x64, IBM Notes 9

No comments:

Post a Comment