Joined: 23 Oct 2013
Online Status: Offline
Posts: 51
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.
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.
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