Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Using a record field to find another record field Post Reply Post New Topic
Author Message
mstibor
Newbie
Newbie


Joined: 23 Oct 2007
Online Status: Offline
Posts: 2
Quote mstibor Replybullet Topic: Using a record field to find another record field
    Posted: 23 Oct 2007 at 8:47am
Hello,
 
I am doing a conditional search to find certain records within a table based on date and other criteria, that works fine, however, I then want to do a second conditional search using one of the fields I found in the first search, in my example, it is a cost code in the format of xx-xx-xxx, I want to find another field in the table based on this "matched" cost code field, however, I am looking for it in a different format, the last three characters are different and it is in a differnet date range.  I tried using a Left({cost code} ,6) & "001" to get the original cost code, but ending in 001 which I get, but when I try to do a second conditional search using that "new" cost code, it only checks the data range from the first search. 
 
Can anyone offer assistance.
 
Thanks, Mike Big%20smile
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 23 Oct 2007 at 9:39am
It sounds like what you are doing is perfectly acceptable and that you are very familiar with string functions and all that. So I would guess that you have to work on your boolean logic. The combination of ANDs and ORs is probably off a bit. Make sure your parentheses are used apprpriately. Here is something that might help
({table.CostCode}="dkkd" AND {table.date}=CDate("11/11/07")) OR ({Left(cost code) &"001" = "doo001" AND {table.date}=CDate("3/3/07"))

If this doesn't help, you can always post the formula here to see if anyone can spot the problem.
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>
IP IP Logged
mstibor
Newbie
Newbie


Joined: 23 Oct 2007
Online Status: Offline
Posts: 2
Quote mstibor Replybullet Posted: 23 Oct 2007 at 10:59am
I think you are close to understanding, but there are probably to many formulas to post, maybe I will try to clarify a bit.
 
I have a Job that runs for say a two year period.  My report runs on a specified week enter through a prompt.  I need to pull several fields to get charges made this week tied to a cost code and a transaction type.
 
OK, now, after I have that, one of the calculations I need to make requires that I use an "estimate" amount that was entered at the beginning of the job and tied to the base cost code xx-xx-001.
 
So, if in the first conditional search that runs from 5-19-07 thru 5-26-07 I find that one of the cost codes that had a charge against was 25-11-360, I need to take that cost code (that was used in that week span) and find the cooresponding estimate cost code 25-11-001 that could have been a year or so earlier.  I cannot pull ALL cost codes ending in 001 because only a few may have had charges that one week.
 
I hope that clears it up a little bit, if not, maybe I can try to post the relevant formulas.
 
Thanks, Mike
 
 
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 23 Oct 2007 at 11:23am
I think I see what you mean now. What I would do is create a subreport that is passed the current cost code and date. Then in the subreport you can filter on the "001" codes with the new date range. Since you are 'dynamically filtering' the data, then you don't know what data you need to look at ahead of time. But using a subreport lets you run another selection criteria in the middle of the report using different criteria.
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>
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.000 seconds.