@DBLookup problem

Dear all expert,

I had try with the below formula, but it show me error message:

Field : ‘abc’ : Incorrect datatype for database function.

The formula for that field is:

@If(zNRouteTo=“”;@DbLookup(“”:“NoCache”;“domino_strc”:“sborg.ntf”;“manageAdmin”;“Department”;“Email”);zNRouteTo)

what is the mistake?

Thank You.

Subject: Verify data types and confirm @DbLookup functions properly

Hello. At first glance, I don’t see anything wrong with this formula. My first suggestion is for you to confirm that the data types of the abc field, znRouteTo and the @DbLookup return field Email are all the same. If abc is not multi value then the @DbLookup return field Email should not be either. Second, I would suggest that you put the @DbLookup in an @Prompt([OK]… in a button on the same form and click it to ensure the @DbLookup is functioning properly. If the @DbLookup is returning multi values then concatenate them before displaying them in the @Prompt.

Subject: multiple values

ok - i’ll admit its been probably 5 yrs since i’ve looked at a dblookup command and i’m doing this from the top of my head - no easy way…lol

my guess is that because you’re utilizng a key of department to pull email that you are finding multiple entries in the view and it is returning them as an array…

first - lets test my theory @Prompt(@elements( … your dblookup code…))

that will tell you what it is finding. Now - if you are seeing it in an agent - just run the agent manually…

Ok - step 2: if i’m correct - then you can strip out our little test…then you can add the [unique] tag on the dblookup to get only the unique values (if i remember correctly) or you can do an @Trim(@unique(…))

Final step - fix the data and correct the code in the database allowing it to happen.

An additional possible cause would be data type but that would only be applicable if it is a sstrcutred data store as notes natively treats all fields as a variable data type (regardless of what they tell ya :wink:

again - i’m leaning more towards the first…

Subject: @Prompt(@Elements(…@dblookup()))

Dear Darren,

I had try to make this formula to becomoe more straight forward.

The dblookup is now:

@DBLookup(“”:“NoCache”;“”;“manageAdmin”;zRequestBy;“HOD Email”)

Where it will lookup the HOD Email according to the zRequestBy (Employee email) which I maintained and from the view manageAdmin E.g.:

HOD Email: david/sales/sbt

zRequestBy (Employee Email): alex/sales/sbt, edwin/sales/sbt, …

So the lookup will perform to lookup for the HOD email according to the requestor.

But it seems like did not return me anything but blank. I put this formula within the default value of a computed value.

Thank you.