In custom report, can we limit the number of rows to be populated, I need only 1 row to be queried

Which IIQ version are you inquiring about?

8.3

Task Definition XML:

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE TaskDefinition PUBLIC "sailpoint.dtd" "sailpoint.dtd">
<TaskDefinition created="1727095362600" executor="sailpoint.reporting.LiveReportExecutor" id="0ab7a60b920f105281921ee7d4284d28" modified="1727116406507" name="PP JLR Genric Report" resultAction="Delete" significantModified="1727116406507" 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="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;
                      import java.util.regex.Pattern;


                      Calendar min = Calendar.getInstance();

                      // this is to check if any valid input is passed, consider that otherwise default value of past 10 days is considered
                      if(value != null){
                      boolean isMatch = false;
                      isMatch = Pattern.compile("^\\d+$").matcher(value).find();

                      if(isMatch){
                      min.add(Calendar.DATE,  -Integer.parseInt(value));
                      }else{
                      min.add(Calendar.DATE, -10);
                      }
                      }else{
                      min.add(Calendar.DATE, -10);
                      }
                      Date minDate = min.getTime();
                      queryOptions.addFilter(Filter.ge("created",minDate));

                      return queryOptions; 
                    </Source>
                  </QueryScript>
                </Parameter>
              </QueryParameters>
            </DataSource>
            <ReportForm>
              <Reference class="sailpoint.object.Form" id="0ab7a60b920f105281921ee7567e4d27" name="Form-PP-Weekly-Exit-Users-Report"/>
            </ReportForm>
            <Columns>
              <ReportColumnConfig field="target" header="EMPLOYEE JOINER" property="target" sortable="true" width="110">
                <RenderScript>
                  <Source>
                    import sailpoint.api.IdentityService;
                    import sailpoint.api.SailPointContext;
                    import java.util.*;
                    import sailpoint.object.*;
                    import sailpoint.api.ObjectUtil;
                    import java.io.File;
                    import java.util.List;
                    import sailpoint.tools.Util;
                    import sailpoint.object.Identity;


                    QueryOptions queryOptions = new QueryOptions();

                    int count;


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

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

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

                    return count;
                  </Source>
                </RenderScript>
              </ReportColumnConfig>
			  <ReportColumnConfig field="target" header="EMPLOYEE TERMINATION" property="target_1" sortable="true" width="110">
                <RenderScript>
                  <Source>
                    import sailpoint.api.IdentityService;
                    import sailpoint.api.SailPointContext;
                    import java.util.*;
                    import sailpoint.object.*;
                    import sailpoint.api.ObjectUtil;
                    import java.io.File;
                    import java.util.List;
                    import sailpoint.tools.Util;
                    import sailpoint.object.Identity;


                    QueryOptions queryOptions = new QueryOptions();

                    int count;


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

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

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

                    return count;
                  </Source>
                </RenderScript>
              </ReportColumnConfig>
			  <ReportColumnConfig field="target" header="CW JOINER" property="target_2" sortable="true" width="110">
                <RenderScript>
                  <Source>
                    import sailpoint.api.IdentityService;
                    import sailpoint.api.SailPointContext;
                    import java.util.*;
                    import sailpoint.object.*;
                    import sailpoint.api.ObjectUtil;
                    import java.io.File;
                    import java.util.List;
                    import sailpoint.tools.Util;
                    import sailpoint.object.Identity;


                    QueryOptions queryOptions = new QueryOptions();

                    int count;


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

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

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

                    return count;
                  </Source>
                </RenderScript>
              </ReportColumnConfig>
			  <ReportColumnConfig field="target" header="CW TERMINATION" property="target_3" sortable="true" width="110">
                <RenderScript>
                  <Source>
                    import sailpoint.api.IdentityService;
                    import sailpoint.api.SailPointContext;
                    import java.util.*;
                    import sailpoint.object.*;
                    import sailpoint.api.ObjectUtil;
                    import java.io.File;
                    import java.util.List;
                    import sailpoint.tools.Util;
                    import sailpoint.object.Identity;


                    QueryOptions queryOptions = new QueryOptions();

                    int count;


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

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

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

                    return count;
                  </Source>
                </RenderScript>
              </ReportColumnConfig>
			  <ReportColumnConfig field="target" header="EMPLOYEE REHIRE" property="target_3" sortable="true" width="110">
                <RenderScript>
                  <Source>
                    import sailpoint.api.IdentityService;
                    import sailpoint.api.SailPointContext;
                    import java.util.*;
                    import sailpoint.object.*;
                    import sailpoint.api.ObjectUtil;
                    import java.io.File;
                    import java.util.List;
                    import sailpoint.tools.Util;
                    import sailpoint.object.Identity;


                    QueryOptions queryOptions = new QueryOptions();

                    int count;


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

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

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

                    return count;
                  </Source>
                </RenderScript>
              </ReportColumnConfig>
			  <ReportColumnConfig field="target" header="CW REHIRE" property="target_3" sortable="true" width="110">
                <RenderScript>
                  <Source>
                    import sailpoint.api.IdentityService;
                    import sailpoint.api.SailPointContext;
                    import java.util.*;
                    import sailpoint.object.*;
                    import sailpoint.api.ObjectUtil;
                    import java.io.File;
                    import java.util.List;
                    import sailpoint.tools.Util;
                    import sailpoint.object.Identity;


                    QueryOptions queryOptions = new QueryOptions();

                    int count;


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

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

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

                    return count;
                  </Source>
                </RenderScript>
              </ReportColumnConfig>
            </Columns>
          </LiveReport>
        </value>
      </entry>
    </Map>
  </Attributes>
  <Description>Displays Terminated users information</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,

you can add another condition to your filter, on id or on name of object

Hi @spratyush ,

add this line will limit the result

return queryOptions.setResultLimit(1);
2 Likes

Could you please specify which condition and what to add exactly?

In the ReportColumnConfig section?

follow the solution of @Arun-Kumar and put his code on QueryScript section

1 Like

This worked, thanks!