Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Report Design
Message Icon Topic: Selecting data within a table Post Reply Post New Topic
Author Message
cheryla
Groupie
Groupie


Joined: 23 Oct 2013
Online Status: Offline
Posts: 51
Quote cheryla Replybullet Topic: Selecting data within a table
    Posted: 29 Apr 2016 at 6:39am
Hi! I am working on a report where I need to select data based on another filed in the report. The problem is that the data in the field I want has letters/numbers either before of after the data I want to select.
For example:

(table A)
19448

(table B)
S15926-3
S19448-1
19448-2
19844-10
etc.

I need my report to look at table A for the number and then select (from multiple numbers) the most similar from table B because I will be pulling in other fields from table B. So my result should only show me S19448-1 and 19448-2.

I hope this makes sense.

Thank you for any and all help on this.

IP IP Logged
Valert16
Groupie
Groupie
Avatar

Joined: 21 Mar 2016
Location: Spain
Online Status: Offline
Posts: 57
Quote Valert16 Replybullet Posted: 30 Apr 2016 at 7:51am
If you want to show tableA.field and all tableB fields that "contain" tableA.field, you should use a subreport. This way, you could place tableA.field in details a section, and the subreport in details b.

The subreport must show tableB.field (and other fields you need). When inserting the subreport, use this settings in the Link tab: "Field(s) to link to": table1.field; "Subreport parameter field to use": choose the parameter proposed by Crystal, it begins with "?Pm-"; "Select data in subreport based on field" must be checked; finally choose tableB.field from the list a of tableB fields available. Click OK.

Now you have to modify the selection formula in the subreport. From the main report, Right click on the subreport --> Edit subreport. In the subreport, go to Select Expert and modify the selection formula, which must show something like
{Table2.Field} = {?Pm-Field}
Modify it to
{Table2.Field} like '*' + {?Pm-Field} + '*'
Now you should see all fields from table 2 that "contain" table1.field.

Maybe there are other solutions, but this one seems simple.
IP IP Logged
cheryla
Groupie
Groupie


Joined: 23 Oct 2013
Online Status: Offline
Posts: 51
Quote cheryla Replybullet Posted: 19 May 2016 at 8:15am
Sorry it took so long to report back but this worked very well! Thx so much for your help.
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.015 seconds.