Solved

Crystal Reports: database table lookup in formula

Posted on 2011-09-12
3
473 Views
Last Modified: 2012-05-12
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?
0
Comment
Question by:BlearyEye
3 Comments
 
LVL 100

Expert Comment

by:mlmcc
ID: 36526658
The full versions of Crystal have what os called a SQL Expression.

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
0
 
LVL 19

Accepted Solution

by:
GJParker earned 500 total points
ID: 36528916
This isn't practical in CR without using subreports which would have an impact on performance. Why can't you simply add the states table to the report and link on the statecode field.
0
 
LVL 1

Author Comment

by:BlearyEye
ID: 36531024
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.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

791 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question