Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

'@If' valuates an entire ResultList and not one by one..?!

Status
Not open for further replies.

apfelsine

Programmer
Jul 20, 2001
4
DE
Hello,

I'm using Lotus Notes to make a menu on a website. Now I've got
trouble with a simple IF-Function and its driving me crazy.

I get a column from a specific view as a list. this list for example
contains three fields (departments;projects;telephones)
Now with Link=@dbColumn("":"NoCache";"":"espanol.nsf";"Menu";Menupoint;"Link")
im going to look another column to see if
in there is a link in one or more available

Menupoint | Link
----------------------------------------------
----------------------------------------------
departments| |
----------------------------------------------
projects | |
-----------------------------------------------
telephones | |
-----------------------------------------------
Now I want to say
@IF(Link="";"Do Nothing";Link)

result of Link looks like this (;;as in a normal function it treats one by one, but @if
function uses an conjunction of all results and writes
three times the same: "Do Nothing"
how can I avoid that ? how can i tell the function that its got
to look one result by one?
I'm really frustrated and I hope I descriped this problem well
so you can understand what I mean.

thanks for your patience

kind regards
apfelsine :)
 
When addressing the values, you have to remember that Link is a text list, with each item delimited by a semicolon (;). If you use that information, along with the many text-parsing formula functions, you should have no trouble finding (or avoiding) the non-whitespace entries in your column.

Another way to tackle the problem would be to create an array from the column values and step through it as you look for links. This is really a programmatic way of looking at a text list, but maybe it will work better for you.

Hope this helps. "One fish, two fish,
Red fish, blue fish."

 
Formula language processes lists in one big gulp every time. This can be hard to get used to, but it can also be very powerful.

Link=@dbColumn ("":"NoCache";"":"espanol.nsf";"Menu";Menupoint;"Link");

Link2 := @If(@IsError(Link); @Text(Link); @Trim(@Unique(Link)));

Now, Link2 = a single item list. The Link2 creation line tests for an error in Link. If it finds an error, it returns the text of the error. If there is no error, then it gets rid of empty results with @Trim, and combines identical results with @Unique.

You can do more complex stuff, too.

If Link were to come back with a 2 item list, with 2 nulls like:

NULL
NULL

Then you could do something like

Link3 := [a href=\" + Link + "\"]Click here for " + Link + "![/a]";

This would output:
[a href="[URL unfurl="true"]http://link1"[/URL]]Click here for [/a]
[a href=""]Click here for ![/a]
[a href="[URL unfurl="true"]http://link1"[/URL]]Click here for [/a]
[a href=""]Click here for ![/a]

Of course, you would want to use the @Trim function so that you didn't receive the 2 null lines. Read the documentation on the concatenation operators in formula language, and you can learn a number of useful tricks.

Kevin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top