Search code examples
crystal-reports

Sub report links in crystal reports


I have a report having a command object where I have empno and some columns. And I have another command object which also having empno. For 1st command the parameter is division and based on division I will get some empnos in 1st commnd object and I need to pass this empnos from 1st command object to 2nd command object. So that the 2nd command object should get some empnos from 1st command object and should display countries based on the matched empnos . So I linked both command objects empnos in links tab. Due to some performance issue I am doing like this

Created a sub report with 2nd command object and created empno parameter. Now in sub reports links tab I am passing main reports empno to sub reports empno parameter. But I am getting non matching empnos data.

Please suggest

Here what I observed in my 1st table have data like this.

eno            name            division

1                  aaa                 2
2                  bbb                 2
3                  ccc                 2

In my 2nd table I have data like this

eno            country            division

1                 India                2
2                 Aus                 2

By using 1st method(linking command objects in links tab). I am getting result like this.

eno            name            division        country

1                  aaa                 2                Ind
2                  bbb                 2                Aus

By using 1st method(Sub report approach). I am getting result like this.

eno            name            division        country

1                  aaa                 2                Ind
2                  bbb                 2                Aus
3                  ccc                 2              

I need to get only employees present in both tables using sub report approach. Please suggest

Hi Siva i am unable to post the image I am getting data like this.In my 2nd table I have onlt enos 1 and 2 .But I am getting all the emps even I used record selection formula also

**eno name division country

1                  aaa                 2                Ind
2                  bbb                 2                Aus
3                  ccc                 2**              

Solution

  • when you use sub report for this purpose then you should not link parameters of main report to sub report instead you should use the linked parameter in Record Selection Formula of sub report then your filtering applies to sub report.

    for e.g:

    pass the parameter to sub report through links (Take care dont link the parameters) then you will get siomething like this {pm-parameter1}.

    then go to record selectoin formula and write as

    database field = {pm-parameter1}