Formula not evaluating for dbcolumn entries

I Have reposted this problem as no one seems to be able to help me and I Really need a reply…

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.

(I Have now tested this with various different elements of the formula language and they all seem to evaluate once 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: Formula not evaluating for dbcolumn entries

I think your formula is working correctly, but your logic is off. This line :

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

If the email is blank, then you will replace it with the entire DspName list, not the sub-element of the list which corresponds to the email because although the @If might work through Email one by one, you’re just referencing DspName as a whole. (Hope that makes sense).

To get round this, I would probably use @For and loop through the entries. You might be able to do a search with @Replace, but using lists in @Replace is one of those things I always have to have a look at the help for!

Hope this helps,

Craig.

Subject: Formula not evaluating for dbcolumn entries

@If does not loop, and in any case, = operator tests a whole list at once. Look at @Transform.

There’s a limit to how much data you can handle in a keyword formula – if your address book grows too large, this formula will not work in any case. Certainly you should not produce entries of the form “Green, Ralph|Green, Ralph” when the shorter string “Green, Ralph” does the same thing.