SWAPI – KpiExecute

Use this command to calculate a Kpi value between two dates in SuccessWare®21. Include a GroupByList when you want the Kpi values by technician, job class, lead source, etc. Include a FilterList when you want to limit the values to a particular technician, job class, lead source, etc.

Request

<?xml version="1.0" encoding="UTF-8"?>

<SessionRequest Version="string" SessionID="{3E6C8178-9AAE-4B8F-9ABD-6084FC7B78DB}" RequestID="string">

    <KpiExecute Version="string">

        <KpiID>int</KpiID>

        <StartDate>date</StartDate>

        <EndDate>date</EndDate>

        <GroupByList>string</GroupByList>

        <FilterList>string</FilterList>

    </KpiExecute>

</SessionRequest>

 

·         KpiID – The ID of the Kpi you want to calculate

o    Can be obtained from the KpiListQuery SWAPI command

·         StartDate – The beginning date

·         EndDate – The ending date

·         GroupByList – A comma separated list of group by names

o    Valid names can be obtained from the KpiGroupByQuery SWAPI command.

·         FilterList - A comma separated list of filters to restrict the calculation to

o    Each filter must be in the format GroupByName=Value

o    Kpi’s can only be filtered by fields they can be grouped by

o    Valid names can be obtained from either the KpiGroupByQuery or KpiListQuery SWAPI commands.

o    Valid filter values can be obtained from the KpiFilterValuesQuery SWAPI command.

Response

<?xml version="1.0" encoding="UTF-8"?>

<KpiExecuteResponse Successful="true" ResultCode="000" ResultText="Successful" Version="1.9.900.1" RequestID="string">

   <KpiExecuteData ReturnedRows="1">

      <KpiExecuteRecord>

         <KpiValue>number</KpiValue>

         <GroupByList>

            <GroupBy>

               <Name>string</Name>

               <Value>string</Value>

            </GroupBy>

         </GroupByList>

      </KpiExecuteRecord>

   </KpiExecuteData>

</KpiExecuteResponse>

 

·         GroupBy – One node will be returned for each group by name you specified in the request. The node will contain two attributes:

o    Name – the name of the grouping

o    Value – the value

·         KPIValue – The numerical value of the executed Kpi


 

Examples

No GroupByNames or FilterValues

<?xml version="1.0" encoding="UTF-8"?>

<SessionRequest Version="string" SessionID="{3E6C8178-9AAE-4B8F-9ABD-6084FC7B78DB}" RequestID="string">

    <KpiExecute Version="string">

        <KpiID>4</KpiID>

        <StartDate>2015-01-01</StartDate>

        <EndDate>2015-12-31</EndDate>

        <GroupByList></GroupByList>

        <FilterList></FilterList>

    </KpiExecute>

</SessionRequest>

 

 

<?xml version="1.0" encoding="UTF-8"?>

<KpiExecuteResponse Successful="true" ResultCode="000" ResultText="Successful" Version="1.9.900.1" RequestID="string">

   <KpiExecuteData ReturnedRows="1">

      <KpiExecuteRecord>

         <KpiValue>1392</KpiValue>

         <GroupByList />

      </KpiExecuteRecord>

   </KpiExecuteData>

</KpiExecuteResponse>

 

One GroupByName and one FilterValue

<?xml version="1.0" encoding="UTF-8"?>

<SessionRequest Version="string" SessionID="{3E6C8178-9AAE-4B8F-9ABD-6084FC7B78DB}" RequestID="string">

    <KpiExecute Version="string">

        <KpiID>1</KpiID>

        <StartDate>2015-01-01</StartDate>

        <EndDate>2015-12-31</EndDate>

        <GroupByList>Primary Technician (Code)</GroupByList>

        <FilterList>Primary Technician (Code)=LEAKLO</FilterList>

    </KpiExecute>

</SessionRequest>

 

 

<?xml version="1.0" encoding="UTF-8"?>

<KpiExecuteResponse Successful="true" ResultCode="000" ResultText="Successful" Version="1.9.900.1" RequestID="string">

   <KpiExecuteData ReturnedRows="1">

      <KpiExecuteRecord>

         <KpiValue>104</KpiValue>

         <GroupByList>

            <GroupBy>

               <Name>Primary Technician (Code)</Name>

               <Value>LEAKLO</Value>

            </GroupBy>

         </GroupByList>

      </KpiExecuteRecord>

   </KpiExecuteData>

</KpiExecuteResponse>


 

Two GroupByNames and two FilterValues

<?xml version="1.0" encoding="UTF-8"?>

<SessionRequest Version="string" SessionID="{3E6C8178-9AAE-4B8F-9ABD-6084FC7B78DB}" RequestID="string">

    <KpiExecute Version="string">

        <KpiID>1</KpiID>

        <StartDate>2015-01-01</StartDate>

        <EndDate>2015-12-31</EndDate>

        <GroupByList>Primary Technician (Code),Job Class</GroupByList>

        <FilterList>Primary Technician (Code)=CARREI,Primary Technician (Code)=LEAKLO</FilterList>

    </KpiExecute>

</SessionRequest>

 

 

<?xml version="1.0" encoding="UTF-8"?>

<KpiExecuteResponse Successful="true" ResultCode="000" ResultText="Successful" Version="1.9.900.1" RequestID="string">

   <KpiExecuteData ReturnedRows="4">

      <KpiExecuteRecord>

         <KpiValue>4</KpiValue>

         <GroupByList>

            <GroupBy>

               <Name>Primary Technician (Code)</Name>

               <Value>CARREI</Value>

            </GroupBy>

            <GroupBy>

               <Name>Job Class</Name>

               <Value>Drain/Sewer</Value>

            </GroupBy>

         </GroupByList>

      </KpiExecuteRecord>

      <KpiExecuteRecord>

         <KpiValue>2</KpiValue>

         <GroupByList>

            <GroupBy>

               <Name>Primary Technician (Code)</Name>

               <Value>CARREI</Value>

            </GroupBy>

            <GroupBy>

               <Name>Job Class</Name>

               <Value>Installation</Value>

            </GroupBy>

         </GroupByList>

      </KpiExecuteRecord>

      <KpiExecuteRecord>

         <KpiValue>44</KpiValue>

         <GroupByList>

            <GroupBy>

               <Name>Primary Technician (Code)</Name>

               <Value>LEAKLO</Value>

            </GroupBy>

            <GroupBy>

               <Name>Job Class</Name>

               <Value>PService</Value>

            </GroupBy>

         </GroupByList>

      </KpiExecuteRecord>

      <KpiExecuteRecord>

         <KpiValue>4</KpiValue>

         <GroupByList>

            <GroupBy>

               <Name>Primary Technician (Code)</Name>

               <Value>LEAKLO</Value>

            </GroupBy>

            <GroupBy>

               <Name>Job Class</Name>

               <Value>Service</Value>

            </GroupBy>

         </GroupByList>

      </KpiExecuteRecord>

   </KpiExecuteData>

</KpiExecuteResponse