Passing parameters from main report to subreport in Jasper

前端 未结 3 1193
抹茶落季
抹茶落季 2020-12-03 07:08

I have a JasperReport where I am passing the report Date from a Main Report to a sub report. This works fine. I also have another where I am passing the same parame

3条回答
  •  误落风尘
    2020-12-03 07:48

    My guess is they are using a default value.

    Assuming the name of the Parameter in the Main Report is TEST_DATE and the name in the Sub-report is TEST_DATE2 then you need to add the following in between the opening and closing subreport elements in the XML:

    
        
    
    

    For the sake of completeness, here is an example that has a main report and a subreport, that should work by just changing the value for SUBREPORT_DIR to point to where you have them placed.

    report1.jrxml

    
    
        
        
        
        
        
            
        
        
            
                
                    
                    
                    
                
                
                    
                    
                        
                    
                    
                    
                
            
        
    
    

    report1_subreport1.jrxml

    
    
        
        
        
        
        
            
                
                    
                    
                    
                
            
        
    
    

提交回复
热议问题