Custom Reports Summation of Columns

Which IIQ version are you inquiring about?

8.3

In custom report, I need to add 1 more column which would be a summation of already populated columns.
How can I achieve that.

The column in the code below would be, totalUserOnboard, but this code is throwing error: please guide.

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE TaskDefinition PUBLIC "sailpoint.dtd" "sailpoint.dtd">
<TaskDefinition created="1727178647992" executor="sailpoint.reporting.LiveReportExecutor" id="0ab7a60b920f1052819223dea9b8775c" modified="1727970756842" name="PP Employee CW JLR Monthly Count Report" resultAction="Delete" significantModified="1727970756842" subType="Identity and User Reports" template="true" type="LiveReport">
  <Attributes>
    <Map>
      <entry key="TaskDefinition.runLengthAverage"/>
      <entry key="TaskDefinition.runLengthTotal"/>
      <entry key="TaskDefinition.runs"/>
      <entry key="report">
        <value>
          <LiveReport title="PP JLR Genric Report">
            <DataSource objectType="sailpoint.object.AuditEvent" type="Filter">
              <QueryParameters>
                <Parameter argument="auditEvents" property="action">
                  <QueryScript>
                    <Source>
                      import sailpoint.object.QueryOptions;
                      import sailpoint.object.Filter;

                      if(value != null){
                      queryOptions.addFilter(Filter.in("action", value));
                      }else{
                      List offboardEvents = new ArrayList();
                      offboardEvents.add("PP_FTE_Offboard");
                      offboardEvents.add("PP_CW_Offboard");
                      offboardEvents.add("PP_Suspension");
                      offboardEvents.add("PP_FTE_Onboard");
                      offboardEvents.add("PP_CW_Onboard");
                      offboardEvents.add("PP_Immediate_Termination");
                      offboardEvents.add("PP_FTE_Rehire");
                      offboardEvents.add("PP_CW_Rehire");

                      queryOptions.addFilter(Filter.in("action", offboardEvents));

                      }
                      return queryOptions;
                    </Source>
                  </QueryScript>
                </Parameter>
                <Parameter argument="duration" property="created">
                  <QueryScript>
                    <Source>
                      import sailpoint.object.QueryOptions;
                      import sailpoint.object.Filter;

                      import java.text.DateFormat;
                      import java.text.SimpleDateFormat;
                      import java.util.ArrayList;
                      import java.util.Calendar;
                      import java.util.Date;


                      Calendar min = Calendar.getInstance();
                      log.error("Value = " + value);

                      // this is to check if any valid input is passed, consider that otherwise default value of past 10 days is considered
                      if(value != null){
                      min.add(Calendar.DATE,  -Integer.parseInt(value));
                      log.error("Inside input");
                      }else{
                      min.add(Calendar.DATE, -30);
                      log.error("Default value");
                      }

                      log.error("Value = " + value);

                      Date minDate = min.getTime();
                      queryOptions.addFilter(Filter.ge("created",minDate));

                      return queryOptions; 
                    </Source>
                  </QueryScript>
                </Parameter>
                <Parameter argument="limiter" property="rowCount">
                  <QueryScript>
                    <Source>
                      import sailpoint.object.QueryOptions;

                      return queryOptions.setResultLimit(1); 
                    </Source>
                  </QueryScript>
                </Parameter>
              </QueryParameters>
            </DataSource>
            <ReportForm>
              <Reference class="sailpoint.object.Form" id="0ab7a60b920f105281921ee7567e4d27" name="Form-PP-Monthly-JLR-Count-Report"/>
            </ReportForm>
            <Columns>
              <ReportColumnConfig field="employeeJoinerCount" header="Employee Joiner" property="created" sortable="true" width="110">
                <RenderScript>
                  <Source>
                    import java.util.*;
                    import sailpoint.object.*;


                    QueryOptions queryOptions = new QueryOptions();

                    int countEmployeeJoiner;

                    List offboardEvents = new ArrayList();
                    offboardEvents.add("PP_FTE_Onboard");

                    queryOptions.addFilter(Filter.in("action", offboardEvents));
                    queryOptions.addFilter(Filter.ge("created",value));


                    countEmployeeJoiner=context.countObjects(AuditEvent.class, queryOptions);

                    return countEmployeeJoiner;
                  </Source>
                </RenderScript>
              </ReportColumnConfig>
              <ReportColumnConfig field="employeeLeaverCount" header="Employee Terminations" property="created" sortable="true" width="110">
                <RenderScript>
                  <Source>
                    import java.util.*;
                    import sailpoint.object.*;

                    QueryOptions queryOptions = new QueryOptions();

                    int count = 0;

                    List offboardEvents = new ArrayList();
                    offboardEvents.add("PP_FTE_Offboard");
                    offboardEvents.add("PP_Suspension");

                    queryOptions.addFilter(Filter.in("action", offboardEvents));
                    queryOptions.addFilter(Filter.ge("created",value));

                    List events = context.getObjects(AuditEvent.class, queryOptions);

                    if (events != null){
                    for (AuditEvent event : events) {
                    Map attributes = event.getAttributes();
                    String ppUsrType = (String) attributes.get("ppUsrType");

                    if ("employee".equalsIgnoreCase(ppUsrType)) {
                    count++;
                    }
                    }
                    }

                    return count;
                  </Source>
                </RenderScript>
              </ReportColumnConfig>
              <ReportColumnConfig field="cwJoinerCount" header="CW Joiner" property="action" sortable="true" width="110">
                <RenderScript>
                  <Source>
                    import java.util.*;
                    import sailpoint.object.*;
                    import java.text.DateFormat;
                    import java.text.SimpleDateFormat;

                    Calendar min = Calendar.getInstance();

                    min.add(Calendar.DATE, -30);
                    Date minDate = min.getTime();

                    QueryOptions queryOptions = new QueryOptions();

                    int countCWJoiner;


                    List offboardEvents = new ArrayList();
                    offboardEvents.add("PP_CW_Onboard");

                    queryOptions.addFilter(Filter.in("action", offboardEvents));
                    queryOptions.addFilter(Filter.ge("created",minDate));

                    countCWJoiner=context.countObjects(AuditEvent.class, queryOptions);

                    return countCWJoiner;
                  </Source>
                </RenderScript>
              </ReportColumnConfig>
              <ReportColumnConfig field="cwLeaverCount" header="CW Terminations" property="action" sortable="true" width="110">
                <RenderScript>
                  <Source>
                    import java.util.*;
                    import sailpoint.object.*;
                    import java.text.DateFormat;
                    import java.text.SimpleDateFormat;

                    Calendar min = Calendar.getInstance();

                    min.add(Calendar.DATE, -30);
                    Date minDate = min.getTime();


                    QueryOptions queryOptions = new QueryOptions();

                    int count = 0;


                    List offboardEvents = new ArrayList();
                    offboardEvents.add("PP_CW_Offboard");
                    offboardEvents.add("PP_Suspension");

                    queryOptions.addFilter(Filter.in("action", offboardEvents));
                    queryOptions.addFilter(Filter.ge("created",minDate));

                    List events = context.getObjects(AuditEvent.class, queryOptions);

                    if (events != null){

                    for (AuditEvent event : events) {
                    Map attributes = event.getAttributes();
                    String ppUsrType = (String) attributes.get("ppUsrType");

                    if ("Non-Employee".equalsIgnoreCase(ppUsrType)) {
                    count++;
                    }
                    }
                    }

                    return count;
                  </Source>
                </RenderScript>
              </ReportColumnConfig>
              <ReportColumnConfig field="employeeRehire" header="Employee Rehire" property="action" sortable="true" width="110">
                <RenderScript>
                  <Source>
                    import java.util.*;
                    import sailpoint.object.*;
                    import java.text.DateFormat;
                    import java.text.SimpleDateFormat;

                    Calendar min = Calendar.getInstance();

                    min.add(Calendar.DATE, -30);
                    Date minDate = min.getTime();


                    QueryOptions queryOptions = new QueryOptions();

                    int countEmpRehire;


                    List offboardEvents = new ArrayList();
                    offboardEvents.add("PP_FTE_Rehire");

                    queryOptions.addFilter(Filter.in("action", offboardEvents));
                    queryOptions.addFilter(Filter.ge("created",minDate));

                    countEmpRehire=context.countObjects(AuditEvent.class, queryOptions);

                    return countEmpRehire;
                  </Source>
                </RenderScript>
              </ReportColumnConfig>
              <ReportColumnConfig field="cwRehire" header="CW Rehire" property="action" sortable="true" width="110">
                <RenderScript>
                  <Source>
                    import java.util.*;
                    import sailpoint.object.*;
                    import java.text.DateFormat;
                    import java.text.SimpleDateFormat;

                    Calendar min = Calendar.getInstance();

                    min.add(Calendar.DATE, -30);
                    Date minDate = min.getTime();


                    QueryOptions queryOptions = new QueryOptions();

                    int countCWRehire;


                    List offboardEvents = new ArrayList();
                    offboardEvents.add("PP_CW_Rehire");

                    queryOptions.addFilter(Filter.in("action", offboardEvents));
                    queryOptions.addFilter(Filter.ge("created",minDate));

                    countCWRehire=context.countObjects(AuditEvent.class, queryOptions);

                    return countCWRehire;
                  </Source>
                </RenderScript>
              </ReportColumnConfig>
              <ReportColumnConfig field="totalUserOnboard" header="Total User OnBoard" property="action" sortable="true" width="110">
                <RenderScript>
                  <Source>
											return countEmployeeJoiner+countCWJoiner+countCWRehire+countEmpRehire;
                  </Source>
                </RenderScript>
              </ReportColumnConfig>
            </Columns>
          </LiveReport>
        </value>
      </entry>
    </Map>
  </Attributes>
  <Description>Displays the count of Employee and CW Joined, Terminated and Rehired in the last 30 days</Description>
  <RequiredRights>
    <Reference class="sailpoint.object.SPRight" id="0ab7a62c8d0d1711818d0d4741930073" name="FullAccessUserReport"/>
  </RequiredRights>
  <Signature>
    <Inputs>
      <Argument name="resultScope" type="Scope">
        <Description>rept_input_result_scope</Description>
      </Argument>
      <Argument multi="true" name="emailIdentities" type="Identity">
        <Description>rept_input_email_recips</Description>
      </Argument>
      <Argument name="auditEvents" required="true" type="string">
        <Description>select Audit event name</Description>
        <Prompt>Enter Audit event name</Prompt>
      </Argument>
      <Argument name="duration" required="true" type="string">
        <Description>Enter numerics, eg. 10</Description>
        <Prompt>Enter no. of days</Prompt>
      </Argument>
    </Inputs>
  </Signature>
</TaskDefinition>

Hi @spratyush,

Populate result values into the “renderCache” for the other columns to use.
Try with below report.

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE TaskDefinition PUBLIC "sailpoint.dtd" "sailpoint.dtd">
<TaskDefinition created="1727178647992" executor="sailpoint.reporting.LiveReportExecutor" id="0ab7a60b920f1052819223dea9b8775c" modified="1727970756842" name="PP Employee CW JLR Monthly Count Report" resultAction="Delete" significantModified="1727970756842" subType="Identity and User Reports" template="true" type="LiveReport">
  <Attributes>
    <Map>
      <entry key="TaskDefinition.runLengthAverage"/>
      <entry key="TaskDefinition.runLengthTotal"/>
      <entry key="TaskDefinition.runs"/>
      <entry key="report">
        <value>
          <LiveReport title="PP JLR Genric Report">
            <DataSource objectType="sailpoint.object.AuditEvent" type="Filter">
              <QueryParameters>
                <Parameter argument="auditEvents" property="action">
                  <QueryScript>
                    <Source>
                      import sailpoint.object.QueryOptions;
                      import sailpoint.object.Filter;

                      if(value != null){
                      queryOptions.addFilter(Filter.in("action", value));
                      }else{
                      List offboardEvents = new ArrayList();
                      offboardEvents.add("PP_FTE_Offboard");
                      offboardEvents.add("PP_CW_Offboard");
                      offboardEvents.add("PP_Suspension");
                      offboardEvents.add("PP_FTE_Onboard");
                      offboardEvents.add("PP_CW_Onboard");
                      offboardEvents.add("PP_Immediate_Termination");
                      offboardEvents.add("PP_FTE_Rehire");
                      offboardEvents.add("PP_CW_Rehire");

                      queryOptions.addFilter(Filter.in("action", offboardEvents));

                      }
                      return queryOptions;
                    </Source>
                  </QueryScript>
                </Parameter>
                <Parameter argument="duration" property="created">
                  <QueryScript>
                    <Source>
                      import sailpoint.object.QueryOptions;
                      import sailpoint.object.Filter;

                      import java.text.DateFormat;
                      import java.text.SimpleDateFormat;
                      import java.util.ArrayList;
                      import java.util.Calendar;
                      import java.util.Date;


                      Calendar min = Calendar.getInstance();
                      log.error("Value = " + value);

                      // this is to check if any valid input is passed, consider that otherwise default value of past 10 days is considered
                      if(value != null){
                      min.add(Calendar.DATE,  -Integer.parseInt(value));
                      log.error("Inside input");
                      }else{
                      min.add(Calendar.DATE, -30);
                      log.error("Default value");
                      }

                      log.error("Value = " + value);

                      Date minDate = min.getTime();
                      queryOptions.addFilter(Filter.ge("created",minDate));

                      return queryOptions; 
                    </Source>
                  </QueryScript>
                </Parameter>
                <Parameter argument="limiter" property="rowCount">
                  <QueryScript>
                    <Source>
                      import sailpoint.object.QueryOptions;

                      return queryOptions.setResultLimit(1); 
                    </Source>
                  </QueryScript>
                </Parameter>
              </QueryParameters>
            </DataSource>
            <ReportForm>
              <Reference class="sailpoint.object.Form" id="0ab7a60b920f105281921ee7567e4d27" name="Form-PP-Monthly-JLR-Count-Report"/>
            </ReportForm>
            <Columns>
              <ReportColumnConfig field="employeeJoinerCount" header="Employee Joiner" property="created" sortable="true" width="110">
                <RenderScript>
                  <Source>
                    import java.util.*;
                    import sailpoint.object.*;


                    QueryOptions queryOptions = new QueryOptions();

                    int countEmployeeJoiner;

                    List offboardEvents = new ArrayList();
                    offboardEvents.add("PP_FTE_Onboard");

                    queryOptions.addFilter(Filter.in("action", offboardEvents));
                    queryOptions.addFilter(Filter.ge("created",value));


                    countEmployeeJoiner=context.countObjects(AuditEvent.class, queryOptions);
                    renderCache.put("countEmployeeJoiner",countEmployeeJoiner);
                    return countEmployeeJoiner;
                  </Source>
                </RenderScript>
              </ReportColumnConfig>
              <ReportColumnConfig field="employeeLeaverCount" header="Employee Terminations" property="created" sortable="true" width="110">
                <RenderScript>
                  <Source>
                    import java.util.*;
                    import sailpoint.object.*;

                    QueryOptions queryOptions = new QueryOptions();

                    int count = 0;

                    List offboardEvents = new ArrayList();
                    offboardEvents.add("PP_FTE_Offboard");
                    offboardEvents.add("PP_Suspension");

                    queryOptions.addFilter(Filter.in("action", offboardEvents));
                    queryOptions.addFilter(Filter.ge("created",value));

                    List events = context.getObjects(AuditEvent.class, queryOptions);

                    if (events != null){
                    for (AuditEvent event : events) {
                    Map attributes = event.getAttributes();
                    String ppUsrType = (String) attributes.get("ppUsrType");

                    if ("employee".equalsIgnoreCase(ppUsrType)) {
                    count++;
                    }
                    }
                    }

                    return count;
                  </Source>
                </RenderScript>
              </ReportColumnConfig>
              <ReportColumnConfig field="cwJoinerCount" header="CW Joiner" property="action" sortable="true" width="110">
                <RenderScript>
                  <Source>
                    import java.util.*;
                    import sailpoint.object.*;
                    import java.text.DateFormat;
                    import java.text.SimpleDateFormat;

                    Calendar min = Calendar.getInstance();

                    min.add(Calendar.DATE, -30);
                    Date minDate = min.getTime();

                    QueryOptions queryOptions = new QueryOptions();

                    int countCWJoiner;


                    List offboardEvents = new ArrayList();
                    offboardEvents.add("PP_CW_Onboard");

                    queryOptions.addFilter(Filter.in("action", offboardEvents));
                    queryOptions.addFilter(Filter.ge("created",minDate));

                    countCWJoiner=context.countObjects(AuditEvent.class, queryOptions);
                    renderCache.put("countCWJoiner",countCWJoiner);
                    return countCWJoiner;
                  </Source>
                </RenderScript>
              </ReportColumnConfig>
              <ReportColumnConfig field="cwLeaverCount" header="CW Terminations" property="action" sortable="true" width="110">
                <RenderScript>
                  <Source>
                    import java.util.*;
                    import sailpoint.object.*;
                    import java.text.DateFormat;
                    import java.text.SimpleDateFormat;

                    Calendar min = Calendar.getInstance();

                    min.add(Calendar.DATE, -30);
                    Date minDate = min.getTime();


                    QueryOptions queryOptions = new QueryOptions();

                    int count = 0;


                    List offboardEvents = new ArrayList();
                    offboardEvents.add("PP_CW_Offboard");
                    offboardEvents.add("PP_Suspension");

                    queryOptions.addFilter(Filter.in("action", offboardEvents));
                    queryOptions.addFilter(Filter.ge("created",minDate));

                    List events = context.getObjects(AuditEvent.class, queryOptions);

                    if (events != null){

                    for (AuditEvent event : events) {
                    Map attributes = event.getAttributes();
                    String ppUsrType = (String) attributes.get("ppUsrType");

                    if ("Non-Employee".equalsIgnoreCase(ppUsrType)) {
                    count++;
                    }
                    }
                    }

                    return count;
                  </Source>
                </RenderScript>
              </ReportColumnConfig>
              <ReportColumnConfig field="employeeRehire" header="Employee Rehire" property="action" sortable="true" width="110">
                <RenderScript>
                  <Source>
                    import java.util.*;
                    import sailpoint.object.*;
                    import java.text.DateFormat;
                    import java.text.SimpleDateFormat;

                    Calendar min = Calendar.getInstance();

                    min.add(Calendar.DATE, -30);
                    Date minDate = min.getTime();


                    QueryOptions queryOptions = new QueryOptions();

                    int countEmpRehire;


                    List offboardEvents = new ArrayList();
                    offboardEvents.add("PP_FTE_Rehire");

                    queryOptions.addFilter(Filter.in("action", offboardEvents));
                    queryOptions.addFilter(Filter.ge("created",minDate));

                    countEmpRehire=context.countObjects(AuditEvent.class, queryOptions);
                    renderCache.put("countEmpRehire",countEmpRehire);
                    return countEmpRehire;
                  </Source>
                </RenderScript>
              </ReportColumnConfig>
              <ReportColumnConfig field="cwRehire" header="CW Rehire" property="action" sortable="true" width="110">
                <RenderScript>
                  <Source>
                    import java.util.*;
                    import sailpoint.object.*;
                    import java.text.DateFormat;
                    import java.text.SimpleDateFormat;

                    Calendar min = Calendar.getInstance();

                    min.add(Calendar.DATE, -30);
                    Date minDate = min.getTime();


                    QueryOptions queryOptions = new QueryOptions();

                    int countCWRehire;


                    List offboardEvents = new ArrayList();
                    offboardEvents.add("PP_CW_Rehire");

                    queryOptions.addFilter(Filter.in("action", offboardEvents));
                    queryOptions.addFilter(Filter.ge("created",minDate));

                    countCWRehire=context.countObjects(AuditEvent.class, queryOptions);
                    renderCache.put("countCWRehire",countCWRehire);
                    return countCWRehire;
                  </Source>
                </RenderScript>
              </ReportColumnConfig>
              <ReportColumnConfig field="totalUserOnboard" header="Total User OnBoard" property="action" sortable="true" width="110">
                <RenderScript>
                  <Source>
											return renderCache.get("countEmployeeJoiner")+renderCache.get("countCWJoiner")+renderCache.get("countCWRehire")+renderCache.get("countEmpRehire");
                  </Source>
                </RenderScript>
              </ReportColumnConfig>
            </Columns>
          </LiveReport>
        </value>
      </entry>
    </Map>
  </Attributes>
  <Description>Displays the count of Employee and CW Joined, Terminated and Rehired in the last 30 days</Description>
  <RequiredRights>
    <Reference class="sailpoint.object.SPRight" id="0ab7a62c8d0d1711818d0d4741930073" name="FullAccessUserReport"/>
  </RequiredRights>
  <Signature>
    <Inputs>
      <Argument name="resultScope" type="Scope">
        <Description>rept_input_result_scope</Description>
      </Argument>
      <Argument multi="true" name="emailIdentities" type="Identity">
        <Description>rept_input_email_recips</Description>
      </Argument>
      <Argument name="auditEvents" required="true" type="string">
        <Description>select Audit event name</Description>
        <Prompt>Enter Audit event name</Prompt>
      </Argument>
      <Argument name="duration" required="true" type="string">
        <Description>Enter numerics, eg. 10</Description>
        <Prompt>Enter no. of days</Prompt>
      </Argument>
    </Inputs>
  </Signature>
</TaskDefinition>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.