Solved

Crystal Reports: database table lookup in formula

Posted on 2011-09-12
3
487 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Running ftp server and transfering data to the path using Windows Service 6 49
Analyze Shared Variable? 7 43
Timezone help 5 45
Timeouts during development 3 28
Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

734 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