Link to home
Start Free TrialLog in
Avatar of edwardy
edwardy

asked on

The "key" in Dblookup formula

Suppose a formula in  button click action as below:
@DbLookup(""; @Subset(@DbName;1):"FORMREF.NSF"; "Data Reference";XYZ; 2));


I find it fail to lookup when the XYZ is a field of names type. Do you all think there are possible to make the dblookup possible to lookup with names field.
Avatar of zvonko
zvonko

first of all I would extend this code to be error proof:
FIELD XYZ:=XYZ;
FIELDResult:=Result;
@If(XYZ="";@Return("");"");
tmpValue:=@DbLookup(""; @Subset(@DbName;1):"FORMREF.NSF"; "Data Reference";XYZ;2);
@If(@isError(XYZ);@SetField("Result";@Text(XYZ));@SetField("Result";@Implode(XYZ)))


Second; there is a names lookup command: @NameLookup
But what item would you like to lookup in address book person document?



Sorry,

this is the proven error proof code :-)
FIELD XYZ:=XYZ;
FIELDResult:=Result;
@If(XYZ="";@Return("");"");
tmpValue:=@DbLookup(""; @Subset(@DbName;1):"FORMREF.NSF"; "Data Reference";XYZ;2);
@If(@IsError(tmpValue);@SetField("Result";@Text(tmpValue));@SetField("Result";@Implode(tmpValue)))

Here is the code to lookup email address from server names.nsf:
FIELD XYZ:=XYZ;
FIELD Result:=Result;
@If(XYZ="";@Return("");"");
tmpValue:=@DbLookup(""; @Subset(@DbName;1):"names.NSF"; "$Users";XYZ;9);
@If(@IsError(tmpValue);@SetField("Result";@Text(tmpValue));@SetField("Result";@Implode(tmpValue)))

But easier one would be:
FIELD XYZ:=XYZ;
FIELD Result:=Result;
@If(XYZ="";@Return("");"");
tmpValue:=@NameLookup([Exhaustive];XYZ;"InternetAddress");
@If(@IsError(tmpValue);@SetField("Result";@Text(tmpValue));@SetField("Result";@Implode(tmpValue)))

You see what I mean?


Avatar of edwardy

ASKER

Thnaks  all your response.

If the field xyz is a filed of Names type e.g a select box with address lookup dialoge box., it make the DBlookup not work. As the KEy should be a text type right?
ASKER CERTIFIED SOLUTION
Avatar of zvonko
zvonko

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hello edwardy,

at the moment you have a dozen open question in LotusNotes topic area. Please review then and delete this one in which you are no more interested. Or accept the appropriate comment as an answer.

But please do not let your questions in abandoned state.

Thanks,
zvonko
Finalized by
Moondancer - EE Moderator
Thanks Moondancer :-)