Create Report Guide

Last modified 06 Mar 2023 23:33 +01:00
Since 4.4
This functionality is available since version 4.4.

This guide describe how to create report in GUI. We chose the example report of accounts with resource as parameter and with columns which shows some attributes from owner, to demonstrate all the functionality.

In first step we click on 'Reports' in left menu and next click on 'All Reports' in submenu. In footer of showed report table we click on new report button.

create report 0

We want to create Collection report, so we select 'Collection report' in showed popup.

create report 1

Now we see page for editing/creating report. We can fill basic properties, we need fill only name.

create report 2

Next we can define type of exported file on tab 'Export'. Collection report have default CSV format, so we don’t need fill it.

Basic configuration of report define engine, so we open 'Engine' tab. We can see Basic Tab for report engine. We don’t need fill basic properties of collection report engine.

create report 3

As first we open 'Collection' tab, where we define base collection and filter for shadows. At first we select object collection 'All shadows' as base collection. We want to use resource as parameter, so we have to use it in filter.

Filter
<filter xmlns="http://midpoint.evolveum.com/xml/ns/public/common/common-3"
        xmlns:q="http://prism.evolveum.com/xml/ns/public/query-3">
    <q:ref>
        <q:path>resourceRef</q:path>
        <expression>
            <queryInterpretationOfNoValue>filterAll</queryInterpretationOfNoValue>
            <script>
                <objectVariableMode>prismReference</objectVariableMode>
                <code>
                    import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectReferenceType;

                    if (!resource) {
                        return null;
                    }

                    ObjectReferenceType ort = new ObjectReferenceType();
                    ort.setOid(resource.getOid());
                    ort.setRelation(resource.getRelation());
                    ort.setType(resource.getTargetType());
                    return ort;
                </code>
            </script>
        </expression>
    </q:ref>
</filter>
create report 4

As next, we define parameter, so we open tab 'Parameter' and add new value to table.

create report 5

We fill fileds for name with "resource", for type with "ObjectReferenceType" and for label with "Resource". Now we can edit row by edit button in last row. In panel with details of parameter select "Resource" in dropdown of field for 'Target type'.

create report 6

As next we need define view, so we click on tab 'View' and select type 'Shadow'.

create report 7

In next step we add new columns for shadow attributes name, kind, intent and one column for demonstration of custom column. Creation of columns for shadows attributes is easy. We add three new column and fill fields name, path. When we want some specific label, we can fill it.

create report 8

We add one more new column and fill fields for name with "customColumn" and label with "Intent and Kind". Now we click on edit button in last column of row. We scroll down to 'Export' container and fill attribute expression with next code:

Expression of custom column
<script>
    <code>
      "Intent: " + object.getIntent() + ", Kind: " + object.getKind()
   </code>
</script>
create report 9

Now we can show preview of actual report. We can show preview in bottom of the screen or in popup, we chose popup. For showing table in bottom of screen click on 'Show report preview' or showing in popup click on 'Show report preview in popup'.

create report 10

On report preview we can see table with columns and content, which will be shown in exported file.

create report 11

Now we can add subreport to our report. We close popup and open 'Subreport' tab. We add new column and fill name field with "owner" and field type with "FocusType".

create report 12

In next step we edit new subreport find field expression and set next snippet of code:

Expression of subreport
<script>
    <code>
      midpoint.searchShadowOwner(object.getOid());
   </code>
</script>
create report 13

Now we can add new column for email of owner. We add new column similar as for custom column and we set next snippet to export expression of column. Also we can fix of order of columns, so we edit every column and fill field for 'Previous column' by name of column which we want see before it.

Expression of owner email column
<script>
    <code>
      if (!owner) {
        return null;
      }
      return owner.getEmailAddress();
   </code>
</script>
create report 14

After we added new column, we can show again report preview in popup. We can see new column with email address from owner, which we got from subreports.

create report 15

To end we can save and run report and open task. When task will finish, we can download exported file.

Was this page helpful?
YES NO
Thanks for your feedback