In report definitions, we can create reports using our own SQL statements.

The steps to be taken for this are;


1 -  If we click the right mouse button> New> Other on or in our project,

from the New Select a Wizards screen under the Logo Platform Tailor folder

Select the LPT Report Layout field and click on the "Next" Button.


2 -  In the "New Custom Report Wizard" screen that appears, click Filename.

      We define the report name and proceed with the "Next" button.


    

3 - Without making any changes on the incoming screen, we proceed with the "Next" button.

   

4 - On the Report Template and Handler screen, enter the report name and description, select the type, select the field as described in the Query Independent Report, and proceed with the "Next" button.

5 - Finally, the report-dependent java class name can be changed on demand, or the report design and class are created with the "Finish" button without touching the name that the system creates.

6 - We define our own fields by clicking on an empty field on the created report design screen and opening the "Report Variables" screen via UserVariables specified in the picture.


7 - In the "Available Variables" field specified in the picture, we will drag and add the fields we defined onto the section.

8 - In the report design, we can find out the id's of our fields from the "Available Variables" screen. Id numbers will allow us to assign values to these fields in the code part.

  

9 - We can find out the sectionId by clicking on an empty field in the Section and it will be necessary to specify the sections we want to show in the code.

  

10 - When we open the class for the report we change the return value of canPrintSections method to true.

@Override
    public boolean canPrintSections() {
        // TODO Auto-generated method stub
        return true;
    }


11 - By overriding the ExecuteReportDoc method and querying the methods we want to display in our method, we can set the fields to the desired values according to the id numbers we have defined in the method, by using the setVarValue (id number, value) method and by using the printSection () method to set and display the section number in the report. The section specified in the code up to the size of the for loop will be displayed.

@Override
    public boolean executeReportDoc(JLbsReportRunParams runParams) {
        QueryParams queryParams = new QueryParams();
        queryParams.setCustomization(ProjectGlobals.getM_ProjectGUID());
        
        
        QueryBusinessObjects items = new QueryBusinessObjects();
        try {
             String sqlText = "SELECT COUNT(CARDTYPE) AS KART_SAYISI, CARDTYPE AS KART_TIPI FROM U_001_ITEMS GROUP BY CARDTYPE";
             m_Context.getServerQueryFactory().executeSelectQuery(sqlText,queryParams, items, -1); 
            //select("CQStudentBrowser", queryParams , items, -1);
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
            
            if(items.size()>0)
                {
                    
            for(int i=0; i<items.size();i++)
                 {
                QueryBusinessObject item = items.get(i);
       Integer cardCount = QueryUtil.getIntegerProp(item,"KART_SAYISI");
       Integer cardType = QueryUtil.getIntegerProp(item, "KART_TIPI");
                                     
                        setVarValue(5000005, cardCount);
                        setVarValue(5000004, cardType);
                        printSection(1);
                        
                    }
                }
        
        return super.executeReportDoc(runParams);
    }

12 - Finally, as you can see on the report Tree, we have the locations where we want. We can deploy the project.


Telif HakkıKullanım KoşullarıGizlilik
Copyright © 2018 Logo Yazılım