Question

I can't get simple DbLookup formula working with a variable. I have a view with employees and their managers, i get unique managers' records with DbColumn and then i need a list of people managed by this person

pms=Evaluate({@Unique(@Dbcolumn("":"";"":"";"admin";3))})

ForAll pm In pms
   result = Evaluate({@DBlookup("":"";"":"";"admin";} & pm & {;1)})

this doesn't work, i have also tried using vertical bars and additional quotation marks around pm but i keep getting either type mismatch or execution failed errors

result = Evaluate({@DBlookup("":"";"":"";"admin";} & "keyword" & {;1)})

this works fine

Was it helpful?

Solution

You have to enclose the value of pm in quotation marks too:

result = Evaluate({@DBlookup("":"";"":"";"admin";"} & pm & {";1)})

This way it is recognized as a string.

Example:

If pm has a string value "Domino" then Evaluate string has to look like this:

@DBlookup("":"";"":"";"admin";"Domino";1)

but in your original formula version it would be

@DBlookup("":"";"":"";"admin";Domino;1)

BTW, the code would break if pm would contain a quotation mark. If you are sure that can't happen then the code is fine.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top