BlearyEye
asked on
Crystal Reports: database table lookup in formula
I'm using Crystal Reports for VS 2010. In a CR formula I'd like to be able to lookup a database table. The function would be something like this:
lookup(tablename, pk_col, result_col).
For example, lookup("States", "StateCode", "StateName") would look up a state code such as "AK" from table "States" and return "Alaska".
Is there any such thing?
lookup(tablename, pk_col, result_col).
For example, lookup("States", "StateCode", "StateName") would look up a state code such as "AK" from table "States" and return "Alaska".
Is there any such thing?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
The SELECT expression doesn't seem to work in the VS version. That's too bad, since it would be nice if it were available. But adding the extra tables did the trick.
Check the field explorer to see if you have that.
If so create a new one. It is just basically SQL but it can only return a single VALUE.
Something like
SELECT FullStatename FROM States WHERE StateCode = {StateCodeField}
mlmcc