Help with formula - Please

I have an agent with this formula.

Key:=NameFirstContact+NameLastContact;

temp:=@DbLookup( “”:“”;“8825739B:005FFA0C” ;“Team Leader Last Year”; Key;“TeamLeader”);

FIELD TmLdrLstYr:=@If(temp=“1”;“Yes”;temp=“2”;“No”;temp=3;“Unknown”;temp=“4”;“Individual”;“”);

SELECT @All


When I run the agent, the only thing that works is if it is a 1, it will put in Yes, otherwise it leaves it blank. I can see in the lookup view that there are several entries with 2 3 and 4, and I tried testing it with one doc that I know for sure it should have put in “Unknown” (for 3).

I’m not a developer and don’t have a clue about this.

Any help is greatly appreciated.

Thanks in advance

Helen

Subject: Try storing the temp value in another field, so you can see what is actually returned.

also some of your formula has it as a string, some does not:

Key:=NameFirstContact+NameLastContact;

temp:=@DbLookup( “”:“”;“8825739B:005FFA0C” ;“Team Leader Last Year”; Key;“TeamLeader”);

FIELD TmLdrLstYr:=@If(temp=“1”;“Yes”;temp=“2”;“No”;temp=3;“Unknown”;temp=“4”;“Individual”;“”);

SELECT @All

Are there spaces around the values?

Try

Key:=NameFirstContact+NameLastContact;

temp:=@trim(@DbLookup( “”:“”;“8825739B:005FFA0C” ;“Team Leader Last Year”; Key;“TeamLeader”));

FIELD TmLdrLstYr:=@If(temp=“1”;“Yes”;temp=“2”;“No”;temp=“3”;“Unknown”;temp=“4”;“Individual”;“”);

SELECT @All

Subject: Help with formula - Please

I’m not sure what other problems you may be having but for the “3” problem, try placing double quotes around the 3 in temp=3 so it is temp=“3”. The way you have it now, its trying to compare temp to a numeric 3 instead of a character 3.

Hope that helps.

Subject: RE: Help with formula - Please

Thanks for your response. The “” around the 3 fixed it.Helen

Subject: Help with formula - Please

You are missing the quotes (ie. temp= “3”)