@if formula in a dialog list does not work for multiple entries

Please can someone help with this problem that I Have.

Within my organisation we have a web based invoice processing system that written entirely in notes.

The application uses a percussions workflow engine to route invoices as per pre defined authorisation limits.

There is also an email functionality with the application that allows users to send an email to anybody within our organisations address book that will have a url to the invoice attached.

The problem that I have at the moment is with reading the address book.

The notes form consists entirly of pass through HTML apart from the field. The ‘To’ box of the form is an editable dialog list that uses formula for choices.

The formula is as follows:

DspName := @DbColumn( “” : “” ; “” : “names.nsf” ; “people” ; 2 );

Email := @Left(@DbColumn( “” : “NoCache” ; “” : “names.nsf” ; “people” ; 5 ); " @ ");

Email:=@If(@Length(Email)=0;DspName;Email);

DspName + “|” + Email

The problem that I have is with the @If formula as it seems to evaluate once for everything instead of row by row.

What I am trying to achieve is a combo box that displays a name in the format surname, forename but has a value of their email address. If the display name is for a group or external email address then the value should be the same as the display name.

What I end up with is either all entries having the email address as their value unless they are a group in which case the value field is empty or every entry has the displayname as the value.

This appears to all depend on which entry the If statement evaluates first.

I’m not sure if this is expected behaviour? If it is then I would much appreciate a workable solution. If not then where do I go from Here???

Thanks in advance

Scott

Subject: @if formula in a dialog list does not work for multiple entries

try this:

DspName := @DbColumn( “” : “” ; “” : “names.nsf” ; “people” ; 2 );

Email := @Left(@DbColumn( “” : “NoCache” ; “” : “names.nsf” ; “people” ; 5 ); " @ ");

ComboLst := DspName + “|” + Email + “~~”;

@ReplaceSubstring( @ReplaceSubstring( ComboLst; “|"; “” ); "”; “” )

For instance, I tested it and this:

DspName := “A” : “B” : “C” : “D”;

Email := “aa” : “” : “” : “ddd”; REM “Email may be null”;

ComboLst := DspName + “|” + Email + “~~”;

@ReplaceSubstring( @ReplaceSubstring( ComboLst; “|"; “” ); "”; “” )

results in:

A|aa; B; C; D|ddd

Subject: RE: @if formula in a dialog list does not work for multiple entries

Thanks doug but that appears not to be the problem.

It must be something to do with the dbcolumn function returning multiple values.

I tried this:

DspName := @DbColumn( “” : “” ; “” : “names.nsf” ; “people” ; 2 );

Email := @Left(@DbColumn( “” : “NoCache” ; “” : “names.nsf” ; “people” ; 5 ); " @ ");

ComboLst := DspName + “|” + Email + " ";

Combolst :=@ReplaceSubstring(ComboLst; "| "; “|” + DspName );

ComboLst

As ’ , PostRoom’ was the first entry in the list (which is a group), every entry in the list then had the value of ’ , PostRoom’ irrespective of what their email address was.