Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Getting results from one table based on anotther Post Reply Post New Topic
Author Message
shabbaranks
Groupie
Groupie


Joined: 06 Oct 2013
Location: United Kingdom
Online Status: Offline
Posts: 66
Quote shabbaranks Replybullet Topic: Getting results from one table based on anotther
    Posted: 13 Oct 2013 at 8:44pm
Hi guys,

First post so go easy on me. Im trying to get a userid value from a table which is used to hold custom data and linked to other tables. The tables are linked as so


The value I am after is the user_values.text1 and its the value within that column which links to the Eomplyee table. Specifically the Employee.First_name & " " & Employee.Last_name which I have created using a formula.

Is it possible to do something like this? Im more familiar with using dlookups but as I understand it this cant be done within Crystal?

Thanks
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 14 Oct 2013 at 4:44am
yeah, CR can be frustrating that way...You have to link the tables first, and if linking isn't sufficient to get the data, you are pretty much out of luck...

There are options though:
1) my favorite, create a stored proc and have the information updated there
2) create a command object (sql) in the report that creates a table of first/last name combos and an id, then you can use the command table to link the tables that you really want
3)use a subreport (usually undesirable is it is a massive performance hit for a report like this...I think) that would pass the linking values

HTH
IP IP Logged
shabbaranks
Groupie
Groupie


Joined: 06 Oct 2013
Location: United Kingdom
Online Status: Offline
Posts: 66
Quote shabbaranks Replybullet Posted: 14 Oct 2013 at 9:47am
Originally posted by lockwelle

yeah, CR can be frustrating that way...You have to link the tables first, and if linking isn't sufficient to get the data, you are pretty much out of luck...

There are options though:
1) my favorite, create a stored proc and have the information updated there
2) create a command object (sql) in the report that creates a table of first/last name combos and an id, then you can use the command table to link the tables that you really want
3)use a subreport (usually undesirable is it is a massive performance hit for a report like this...I think) that would pass the linking values

HTH


Thanks but I think Im right in saying to use stored procedures you have to run them at the back end? This database is an Access database so I cant do it this way. Im interested in looking at option 2, I don't suppose you have an example of how to achieve this? Thanks
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 15 Oct 2013 at 4:53am
no can't say that I do, but the command would probably look something like this:

select t1.id, t2.first, t2.last
from table1 as t1
join table2 as t2
    on t1.somefield = t2.somefield


this will give you a list of id's and the name, then in the linking part of the report, you can link the id to one table and the names to the other table.

Hopefully there is someway to link the 2 tables.

HTH
IP IP Logged
shabbaranks
Groupie
Groupie


Joined: 06 Oct 2013
Location: United Kingdom
Online Status: Offline
Posts: 66
Quote shabbaranks Replybullet Posted: 18 Oct 2013 at 12:29am
This is now working. I tried to apply too much criteria to the report which nulled the results and wasn't showing anything. I can now get the first name, last name and ID. On to the next challenge. Thank you for your help

Edited by shabbaranks - 18 Oct 2013 at 12:30am
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.027 seconds.