Reports

Now that you've created a view, you might be wondering how to pull more specific information from the database. If you want to do something like joining on multiple tables, you will want to use a report, which gives you the full power of SQL. We'll detail a simple example below which shows you the basic format, and if you want more detail, you can check out the Reports Section.


  1. In the Bookstore project under the Package Explorer, open up reports/Bookstore.reports:
    images/download/attachments/144836601/bookstore_report-version-1-modificationdate-1670861325000-api-v2.png

  2. Copy and paste this report XML inside the ReportList tag, after the report that's already stored there:

    <Report>
    <Name>AllBooks</Name>
    <SqlDef Name="AllBooks" GroupName="SampleSqls"><![CDATA[
    select TITLE, AUTHOR, ISBN, PRICE_AMOUNT, PRICE_UOM, QUANTITY_SOLD, USERS.USER_NAME from ZBKS_BOOK
    inner join USERS on ZBKS_BOOK.SYS_SALES_REP_ID = USERS.SYS_USER_ID
    where ($TITLE_FILTER$ is null or upper(TITLE) like upper($TITLE_FILTER$) || '%')
    ]]></SqlDef>
    <Filters>
    <CustomFilterField>
    <FieldRef levelType="ZBKS.Book" category="PDF">
    <FieldName>Title</FieldName>
    </FieldRef>
    <Type>STRING</Type>
    <SimpleMapping sqlName="TITLE_FILTER"/>
    </CustomFilterField>
    </Filters>
    <Retrieval>
    <CustomRetrievalField>
    <FieldRef levelType="ZBKS.Book" category="PDF">
    <FieldName>Title</FieldName>
    </FieldRef>
    <Type>STRING</Type>
    <ColumnWidth>200</ColumnWidth>
    <SimpleMapping sqlName="TITLE" />
    </CustomRetrievalField>
    <RetrievalField levelType="ZBKS.Book" category="PDF">
    <FieldName>Author</FieldName>
    </RetrievalField>
    <RetrievalField levelType="ZBKS.Book" category="PDF">
    <FieldName>ISBN</FieldName>
    </RetrievalField>
    <RetrievalField levelType="ZBKS.Book" category="PDF">
    <FieldName>QuantitySold</FieldName>
    </RetrievalField>
    <CustomRetrievalField>
    <FieldRef levelType="ZBKS.Book" category="PDF">
    <FieldName>PriceAmount</FieldName>
    </FieldRef>
    <Hidden>true</Hidden>
    <Type>STRING</Type>
    <SimpleMapping sqlName="PRICE_AMOUNT" />
    </CustomRetrievalField>
    <CustomRetrievalField>
    <FieldRef levelType="ZBKS.Book" category="PDF">
    <FieldName>PriceUOM</FieldName>
    </FieldRef>
    <Hidden>true</Hidden>
    <Type>STRING_ENUMERATION</Type>
    <EnumerationType>CurrencyCode</EnumerationType>
    <SimpleMapping sqlName="PRICE_UOM" />
    </CustomRetrievalField>
    <CustomRetrievalField>
    <FieldRef levelType="ZBKS.Book" category="PDF">
    <FieldName>Price</FieldName>
    </FieldRef>
    <Type>COMPOSITE</Type>
    <Sortable>false</Sortable>
    <CompositeFieldType name="PRICE">
    <Component name="PriceAmount" type="STRING" />
    <Component name="PriceUOM" type="STRING_ENUMERATION" />
    </CompositeFieldType>
    <ColumnWidth>110</ColumnWidth>
    <SimpleMapping sqlName="PRICE" />
    </CustomRetrievalField>
    <CustomRetrievalField>
    <FieldRef levelType="ZBKS.Book" category="PDF">
    <FieldName>SalesRep</FieldName>
    </FieldRef>
    <Type>STRING</Type>
    <SimpleMapping sqlName="USER_NAME" />
    </CustomRetrievalField>
    </Retrieval>
    </Report>
  3. Click images/download/attachments/144836601/save_btn-version-1-modificationdate-1670861325000-api-v2.png Save to save the report.

  4. Click images/download/attachments/144836601/submit_btn-version-1-modificationdate-1670861325000-api-v2.png Submit to Server to submit the report to the server. In case Submit button is disabled, please open MPT (this will enable the button) then go back to report tab and click Submit.

  5. Now we need to add an entry to the UiMetaModel to access this report from NEO. Open the Module Process Template.mpt, make sure in the Outline tree that the root element (Module Process Type) is selected, and then click the UiMetaModel tab.

  6. Add the following WebAction to the existing list:

    <WebAction name="AllBooks">
    <OneReactPage>
    <ModulePath>PLT/NeoReport</ModulePath>
    <Properties>
    {
    "reportName": "ZBKS.AllBooks",
    "autoExecute": true
    }
    </Properties>
    </OneReactPage>
    </WebAction>
  7. Then add a menu reference inside the WebActionGroup tag:

    <WebActionRef name="AllBooks"/>
  8. Click images/download/attachments/144836601/save_btn-version-1-modificationdate-1670861325000-api-v2.png Save to save the MPT.

  9. Click images/download/attachments/144836601/submit_btn-version-1-modificationdate-1670861325000-api-v2.png Submit to submit it to the server. Then refresh NEO completely (or log in if not already) to see the new menu item, All Books. Open it to see the report:
    images/download/attachments/144836601/image2021-12-6_16-59-35-version-1-modificationdate-1670861325000-api-v2.png