Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: In Condition in CR 9 Post Reply Post New Topic
Author Message
dipubhargavan
Newbie
Newbie


Joined: 06 Dec 2010
Online Status: Offline
Posts: 3
Quote dipubhargavan Replybullet Topic: In Condition in CR 9
     Posted: 14 Dec 2010 at 2:07am

Hi all,

I need to create a formula which compares the listed number is there in other table, like if I got a recored with the namber as "37" and I have another table which have the same field, I want to know "37" is there in the other table or not.
 
I need to create this with IN condition like
      (if {table.field} in [{Other table.field}] then "Y" else "N")
I have created one like this how ever it is checking only when both values are same for each record like {table.field} = {Other table.field}. please help.
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 14 Dec 2010 at 4:14am
I don't think that it is possible, given straight table joins.  CR does not read other rows of data.
 
2 solutions come to mind.
1) Create a sub report that runs at the start of the report to return a shared delimited stringvar of all the ids in the other table. Use this delimited string to see if the record you are looking at is in the string
 
2) Create a sub report to run just for the item in question and see if it is there.
 
From a performance point of view, the first option is better as you only hit the database 1 additional time, and not a whole lot more.
 
HTH
IP IP Logged
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