@dblookup in agent

How do get @dblookup to work in an agent. I have a web form that needs to lookup several fields when it is saved so the document can be mailed and appear in the correct views. I have signed the agent and I do have mgr access to the database. I have also tried running the agent from the notes client with no results either. I can paste the dblookup into the field in notes and it works fine when the document is refreshed so the code is right. I have even explicitly coded the server name, dbname and a key value to look up by

Thanks

Subject: @dblookup in agent

Why are you using an agent to populate fields? Why not just use form field formulae?

Subject: RE: @dblookup in agent

Need to do dblookups based upon a selected value. Depending on values the document gets mailed to different groups. And will appear in differnt views.

If I put formula’s in, the page does not load on the browser even if I trap for a failure. Was planning on running an agent in the webquerysave

Subject: RE: @dblookup in agent

Try this:

Vector v = session.evaluate( “@DbLookup(etc…)” );

It should return all the values found in a vector. If this does not work then put a firstElement() method on the end so it looks like this:

String s = session.evaluate( “@DbLookup(etc…)” ).firstElement();

Hope that helps!

Subject: RE: @dblookup in agent

lkup_data = @DbLookup(“”:“NoCache”;“”: “”; “(TeamMembers)”;Person";6);@Prompt([Ok];“Lookup Value”;lkup_data);

results in empty prompt but…

If I do this

@Prompt([Ok];“Lookup Value”;@DbLookup(“”:“NoCache”;“”: “”; “(TeamMembers)”;Person;6));

I get the results I need so I do this for the field

@SetField(Field Name;@DbLookup(“”:“NoCache”;“”: “”; “(TeamMembers)”;Person;6));

And everything is fine go figure…