View Column Name - Programmatic Use

one of those days when I think I am losing my mind…

The view column feature allowing programmatic references to prior columns in the view doesn’t seem to be working for me today. It has been some time since I last tried it, and I have successfully used it before.

While my need for it today is insignificant enough that I will probably just drop it, I would like to be reminded if there is something I am missing, for future reference.

I have seen Stan Rogers’ posts on the subject, so I know that the “Show multiple values as separate entries” setting can be trouble. This is not an issue in my case.

Very simple trivial example:

Hidden column 1:

  • programmatic name “isA”

  • column formula “Yes”

Hidden column 2:

  • programmatic name “isNot”

  • column formula “No”

Visible column 3:

  • formula: @if (facility < “M”; isA; isNot)

So the result I would expect:

If facility = “Alpha”, column three should show “Yes”.

If facility = “Theta”, column three should show “No”.

In reality, column three doesn’t appear to contain anything.

I have verified my column names for all three columns, and I don’t see any errors, but I sure could be overlooking something.

I have see this “fail” in both R5 and R6 today, which really makes me it is operator error.

Any suggestions?

Subject: View Column Name - Programmatic Use

I don’t know if this is the only problem, but I think you need a dollar sign before the column name in the formula:

formula: @if (facility < “M”; $isA; $isNot)

Subject: RE: View Column Name - Programmatic Use

If this is necessary, it’s a new one on me. The $ typically refers to the column names assigned by Notes, right? The custom ones I thought were not prefixed by $.

Subject: RE: View Column Name - Programmatic Use

According to Designer Help (bolding is mine):

If you first define a column using a simple function, then you create another column that depends on the value of the first, you must edit the programmatic name of the first column to something other than a dollar symbol ($) and a number. If you put $1 in a formula, it is evaluated to = the quantity/value of 1. If you put “$1” in the formula, it is treated as a string rather than a variable, field or column name.

For example, if the first column in the view is the author (simple function), with a programmatic name of $1 and you want the second column to display something based on the value in column 1, you can change the programmatic name of column 1 from $1 to $one and then refer to the new programmatic name in the formula for column 2. For example: @if($one = “Mary Stone/Acme”;“READ THIS”; “ignore this”)

Note that the customized field name still contains a dollar sign. It’s my understanding that the dollar sign is what helps the formula distinguish between a column name and a field name - what’s to say you don’t have a field called one?

Subject: RE: View Column Name - Programmatic Use

Thanks, Esther. I especially appreciate you pointing out that there is designer documentation on this; I had not seen this before. Couple of thoughts and/or findings:

  1. As I think you are saying, it sounds like the use of the $ is simply a way to identify a field or value in a special way, to distinguish it from form fields. There is nothing otherwise “special” about the $. Since Lotus chose to use it for special document fields like Revisions and such, then we would of course want to avoid using $ except for special circumstances such as this. I could just as easily choose to prefix any column names instead with “col” or “zzz” or anything else that I might choose as a conventional prefix (and avoid using for form fields).

  2. It is interesting to me that the documentation itself is inconsistent. Early in the paragraph, it reads “If you first define a column using a simple function, then you create another column that depends on the value of the first, you must edit the programmatic name of the first column to something other than a dollar symbol ($) and a number.” This statement seems to discourage the developer from the use of the $. Then further down, they imply the use of $ for your custom column name prefix.

  3. The problem that I originally reported in this thread has become a little clearer, but is still puzzling; whether to call it a bug may be debatable. It appears that this technique does not work if you want the programmatic columns to function similar to literal constants. In my problem, I was trying to use column one and two as literal constants to be displayed in subsequent columns, based on the result of formulas. A new (very contrived) example demonstrates this:

Hidden column 1:

column name: constant1

column value:

	First try (fails): "banana"

	Second try (works): Form + "banana"

Visible column 2 formula:

evenMinutes := (@Minute(@Modified))/2 = @Integer(@Minute(@Modified)/2);

@If (evenMinutes; "Even"; second)

In this silly example, if the minutes portion of each document’s last modified time is an even number, then the word “Even” is displayed. If the minutes are odd, I want to display the value computed in column 1.

What actually happens:

If the value in column 1 is nothing but a literal (the one I listed as the first try), then nothing displays in column 2 if the @Modified minutes are odd. If the value in column 1 is computed and the computation includes a field from the document, then I do get the correct value displayed, namely the form followed by the word “banana”.