@For and replace @ERRORS with "-" not working

Scenario:I have a key called KEY1

FIELD1 contains a list. Each element in the list is considered to be KEY1

I use @For in FIELD2 to do a lookup against that key to find me a value.

The following is happening:

FIELD1=

keyA

keyB

keyC

KeyD

The @for loop lookups using keyA and returns “A”, keyB returns “B”, keyC DOES NOT EXIST so i get an @IsError, keyD returns “D”.

FIELD2 to display the results of my @For loop displays the following: @IsError…blah blah not contained in index.

IF i write @If(@isError(lookup) ; “-” ; lookup) for the above results i get only a “-”…what I would like is my list to contain the following:

A

B

D

and NOT just a “-” or ERROR:blah, blah blah…

Is this even possible to do???

Please help with any ideas if you’re able to solve this.

Thanks

ST

Subject: @For and replace @ERRORS with “-” not working

Yes – just put your @If(@IsError) stuff inside the loop to catch the error before appending it to the output value. ERROR is a flat value, and it will “eat” the array (list) you’re trying to build. Something like this:

list := “”;

@For(i:=1; i<=@Count(Field1); i:=i+1;

temp := @DbLookup(“”;“”;“view”;Field1[i];column);

@If(@IsError(temp);

temp := “-”;

“”);

list := list:temp);

@Trim(list)

Subject: RE: @For and replace @ERRORS with “-” not working

On release 6.x you can also use:

@DbLookup (“”:“NoCache” ; “” ; “view”; key ; column ; [FAILSILENT]);

the [FAILSILENT] at the end will cause the @DbLookup to return “” instead of an error.

Let’s use all those new features!

Nicolas Abesdris / PCLP

Quintessence e-solutions Inc.

Subject: RE: @For and replace @ERRORS with “-” not working

Yes, let’s. Good point.