Skip to content
On this page

EPA Components Report

This example will show you how to use Microsoft Power Automate to automatically get all paginated apprentices and their component attempts with grades and build an Excel report.

At the end of this example you should be able to create your own scheduled Power Automate flow to query the ACE360 Connect API, get apprentice data, an apprentice's corresponding TPO, Standard and Components data and add that to an Excel report. This is just an example feel free to try different things and pick data that would be relevant to you.

Contents

Getting Started

Before you can create a Power Automate flow, you'll need access Power Automate itself. It is included with some Office 365 licenses, so if you're already an Office 365 customer check to see if access is included. Otherwise visit here and sign up. Keep in mind that this guide makes use of premium Power Automate features, if you don't have access to Power Automate Pro, you won't be able to follow along.

Your Flow

Once your account is set up and you've logged in you should see something similar to this:

Power Automate Dashboard

This dashboard makes things look pretty complicated. There's a lot going on! In this demo, we're only going to focus on setting up a single automated flow. We'll cover some of the other features and options in later demos.

Configuring Your Flow

Click "Create" from the navigation bar on the left and under the start from blank heading, select "Scheduled cloud flow".

Add a name for your flow, for this example we'll use "Apprentice EPA Components". (If you skip this step, Power Automate will generate a name for you)

Set the date, time, and the frequency you'd like this flow to run at. For this example we'll go with every week, on a monday, at 10:00 AM. Then at the bottom of the dialog click "Create".

Power Automate New Flow

Getting Apprentice Data

To handle pagination, you need to initialize a variable that will be incremented for every page.

Note: ACE360 Connect returns paginated responses. This means we limit the amount of data returned in each request. To get all of your data you'll need to request each page of results.

Select "New Action" or the plus icon to add a new step to your flow.

Power Automate New Action

Search for "variable" and select the "Initialize variable" option under the Variable heading.

Power Automate Apprentice Page Number Variable

Fill out the Name, Type and Value of the variable as follows.

Power Automate Apprentice Page Number Variable Config

The name of the card can also be edited for better readability, especially when there are multiple variables that need to be declared. In this case "Initialize variable" is changed to "ApprenticePageNumber".

To increment the initialized variable for every page retrieved, another variable must be created to denote how much to increment by.

Select "New Action", search for "increment" and select the "Increment variable" option under the Variable heading.

Power Automate Increment Apprentice Page Number

Under the name dropdown, select the initialized variable "ApprenticePageNumber" defined previously and fill in the value as 1.

Power Automate Increment Apprentice Page Number Config

To request data from Connect you'll need to select "New Action", search for "http" and select the "HTTP" option under the HTTP heading.

Power Automate Get Apprentices

Fill out the HTTP step as follows. You'll need a method, URI, and some headers. In the form under the HTTP section, fill out the URI, Method and Headers as follows.

Power Automate Get Apprentices Config

Be sure to enter your own token like so "Bearer 2|abcd...." (don't include the quotes).

You also need to set the page to the previously defined initialized variable "Apprentice Page Number" and set how many apprentices you need perPage.

Before you can work with your data, you'll need to do a bit of processing. This involves selecting the data that the API has sent us, and parsing that response so we can manipulate it. Don't worry, Power Automate can do this for us.

Select "New Action", search for "json" and select the "Parse JSON" option under the Data Operation heading.

Power Automate Parse Apprentices

You need to tell the JSON parser to collect the data or "body" from the Http request.

Power Automate Parse Apprentices Config

TIP: Use the little lightning bolt to select available options.

You'll also need to generate a schema for it to interpret the data. Click the link under the big empty box that says "Use sample payload to generate schema" and paste the following into the window that will have opened.

{
  "total": null,
  "currentPage": null,
  "perPage": null,
  "totalPages": null,
  "data": [
    {
      "id": null,
      "ulnNumber": null,
      "firstName": null,
      "lastName": null,
      "dateOfBirth": null,
      "standardId": null,
      "status": {
        "id": null,
        "text": null
      },
      "tpoId": null,
      "epaoRegisteredDate": null,
      "estimatedStartDate": null,
      "estimatedEndDate": null,
      "esfaCertificateClaimedAt": null,
      "estimatedGatewayAtEpaoRegistration": null,
      "approvedForEpaDate": null,
      "provisionalGrade": null,
      "epaOverallGrade": null,
      "gradeDate": null,
      "createdAt": null,
      "archivedAt": null,
      "withdrawnAt": null,
      "archivalStatus": null,
      "epaoInternalId": null,
      "epaoId": null
    }
  ]
}

It should look something like this:

Power Automate Parse Apprentices Sample Payload

Clicking done will fill the previously empty box with a schema that Power Automate can understand.

To iterate through all the apprentices you need to loop the API call for each page. Select "New Action", search for "do until" and select the "Do Until" option under the Control heading.

Power Automate Do Until Apprentice

Set the loop to run until the increment variable you defined earlier is equal to the total pages.

Power Automate Do Until Apprentice Config

Power Automate Do Until Apprentice Config

Drag the Increment variable, HTTP and Parse JSON actions within the DO until action like shown below.

Power Automate Get Apprentices Flow

Getting EPA Component Attempt Data

To retrieve the paginated list of EPA components for an apprentice you’ll need to loop through each apprentice. We shall follow similar steps as before:

  • Initialize variables
  • Get the data
  • Parse the data
  • Iterate the data

Select "New Action", search for "apply to each" and select the "Apply to each" option under the Control heading.

Power Automate Apply to each apprentice

Select the "Body data" from the parse json step as your output in the dropdown.

Power Automate Apply To Each Apprentice Config

Since the list of component attempts returns a paginated list, we need to define another variable for it’s page numbers.

Select "New Action" under the Apprentice Page Number variable action and search for "variable" and select the "Initialize variable" option under the Variable heading.

Power Automate Component Page Number Variable

Fill in the Name, Type and Value of the variable as follows.

Power Automate Component Page Number Variable Config

Within the apply to each apprentice action, select "New Action", search for "increment" and select the "Increment variable" option under the Variable heading.

Power Automate Component Page Number Increment

Under the name dropdown, select the initialized variable "Component Page Number" defined previously and fill in the value as 1.

Power Automate Component Page Number Increment Config

Select "New Action", search for "http" and select the "HTTP" option under the HTTP heading.

Power Automate Get Component Attempts Http

In the form under the HTTP section, fill out the URI, Method and Headers as follows.

Set the apprentice ID, the page as "Component Page Number" and how many components you need perPage.

Power Automate Get Component Attempts Http Config

Select "New Action", search for "json" and select the "Parse JSON" option under the Data Operation heading.

Power Automate Parse Components

Under the content, select the body from the lightning bolt icon.

Power Automate Parse Components Config

Click on "Use sample payload to generate schema" and paste in the following into the window and click Done.

{
  "total": null,
  "currentPage": null,
  "perPage": null,
  "totalPages": null,
  "data": [
    {
      "id": null,
      "apprenticeId": null,
      "epaAttemptId": null,
      "epaId": null,
      "epaType": null,
      "grade": null,
      "gradeDate": null
    }
  ]
}

It should look something like this:

Power Automate Parse Components Sample Payload

Processing EPA Component Attempt Data

Not every apprentice will have a component attempt, depending at what status they are in. For that we need to set a condition to check if the GET Component Attempts HTTP request has returned any data.

Select "New Action", search for "condition" and select the "Condition" option under the Control heading.

Power Automate Components Condition

Set the condition to check if the returned component attempts total pages is greater than 0.

Power Automate Components Condition Config

Power Automate Components Condition Config

If the component attempts exists, i.e. under the True section, we need to loop through each apprentice’s component attempts.

Select "New Action", search for "apply to each" and select the "Apply to each" option under the Control heading.

Power Automate Apply To Each Component

Select body data from the Parse Components JSON step as your output in the dropdown.

Power Automate Apply To Each Component Config

Similar to the steps to process a paginated list of apprentices, we need to have a "do until" loop within the "apply to each apprentice" action which will retrieve the list of components for every component page returned and then parse it.

Select "New Action", search for "do until" and select the "Do Until" option under the Control heading.

Power Automate Do Until Component

Drag the "Increment Component Page Number", "GET Component Attempts", "Parse Components JSON" and "Do Component Attempts exist" actions within the Do until action.

Power Automate Get Components Flow

We need the "do until" action to run for every component attempt page. But since not every apprentice has component attempts, we create a variable to store the total component attempt pages if it exists and default the variable value to 1 (i.e. always assume a page is returned with no values).

Back at the top, where the variables are declared, select "New Action", search for "variable" and select the "Initialize variable" option under the Variable heading.

Power Automate Total Component Pages Variable

Fill in the Name, Type and Value of the variable as follows.

Power Automate Total Component Pages Variable Config

When the do component attempts exist condition passes, we need to set this newly declared "Total Component Pages" variable to the returned total pages value.

Select "New Action", search for "variable" and select the "Set variable" option under the Variable heading.

Power Automate Total Component Pages Set Variable

Select the "Total Component Pages" variable.

Power Automate Total Component Pages Set Variable Config

Set the do until loop to run till the "Total Component Pages" variable is equal to the "Component Page Number".

Power Automate Do Until Component Config

To reset the component page number to 0 for every apprentice, within the apply to each apprentice action and outside of the do until component action, select "New Action", search for "variable" and select the "Set variable" option under the Variable heading.

Power Automate Reset Component Page Number Variable

Select the "Component Page Number" variable declared previously and set the value to 0.

Power Automate Reset Component Page Number Variable Config

To retrieve an apprentice’s TPO and standard details, under the apply to each apprentice section, select "New Action", search for "http" and select the "HTTP" option under the HTTP heading. Repeat this step to add another HTTP action.

Power Automate Get TPO Http

Power Automate Get Standard Http

In the form under the HTTP section, fill out the URI, Method and Headers for both the actions as follows. Assign the TPO ID as "body tpoId" and Standard ID as "body standardId" from the "Parse Apprentices" action.

Power Automate Get TPO Http Config

Power Automate Get Standard Http Config

To parse the response of both endpoints, select "New Action", search for "json" and select the "Parse JSON" option under the Data Operation heading.

Power Automate Parse Tpo

Power Automate Parse Standard

Under the content of each of the Parse JSON actions, select the body from the lightning bolt icon.

Power Automate Parse Tpo Config

Power Automate Parse Standard Config

Click on "Use sample payload to generate schema" within the GET TPO endpoint and paste in the following into the window and click Done.

{
  "total": null,
  "currentPage": null,
  "perPage": null,
  "totalPages": null,
  "data": [
    {
      "id": null,
      "name": null,
      "street": null,
      "city": null,
      "region": null,
      "postcode": null,
      "contactName": null,
      "contactNumber": null,
      "contactEmail": null,
      "ukprn": null,
      "parentId": null,
      "createdAt": null
    }
  ]
}

It should look something like this:

Power Automate Parse Tpo Sample Payload

Click on "Use sample payload to generate schema" within the GET Standard endpoint and paste in the following into the window and click Done.

{
  "total": null,
  "currentPage": null,
  "perPage": null,
  "totalPages": null,
  "data": [
    {
        "id": null,
        "stCode": null,
        "name": null,
        "level": null,
        "sector": null,
        "datePublished": null,
        "endDate": null,
        "approxMinDuration": null,
        "description": null,
        "archived": null,
        "larsCode": null,
        "courseOption": null,
        "version": null,
        "assessmentPlan": null,
        "numberOfAttachedApprentices": null,
        "highestGrade": null,
        "epas": null
    }
  ]
}

It should look something like this:

Power Automate Parse Standard Sample Payload

Building Your Excel Report

Under the apply to each component action, select "New Action", search for "add a row" and select the "Add a row into a table" option under the Control heading.

Power Automate Added Row To Excel

In this example we're making use of an Excel workbook with a table that lives on our OneDrive. Though you can make use of SharePoint if you'd prefer.

Our Excel workbook started life looking as a blank table with the name "Table1".

Once the table has been found by Power Automate you'll be able to assign data to fields, your config should look something like this:

Power Automate Add Row To Excel Config

In the same section, under Advanced parameters, click on "Show all" to list out all the fields from your excel table.

Fill out the fields with their appropriate values to be displayed in the excel report.

Power Automate Add Row To Excel Values

Power Automate Add Row To Excel Values

Power Automate Add Row To Excel Values

Note that we can retrieve the apprentice and component details from "Parse Apprentices" and "Parse Components" action.

But the GET TPOs and GET Standards endpoint for each apprentice returns an array, hence if we need the data we must specify the array key like below.

                    Body(‘ParseTPO’)?[‘data’][0]['fieldName']

                    Body(‘ParseStandard’)?[‘data’][0]['fieldName']

This basically gets the parsed data, and the first item in the array/list and returns the required field like name, ukprn or stCode. Replace fieldName with the name of the field.

TIP: Use the little fx icon to type in the expression.

Once you've assigned the right json fields to correct columns, "Save" your flow.

Power Automate Add Row To Excel All Values

Assuming your flow saved without errors, it's time to test your new flow.

Using the toolbar at the top right of the screen click "Test".

Power Automate Toolbar

Under your test flow sidebar, click "Manually", then "Test", "Run flow" and finally "Done".

It'll take a minute but your flow should run. Keep an eye on your Excel workbook and on the status of your flow.

After a minute or so you should start seeing entries appearing in your Excel report.

Power Automate Excel Report

And that's the basics of getting components data from ACE360 Connect into an Excel workbook.

Summary

By following this tutorial you should now be able to create custom Excel reports using Power Automate. The example we provided here won't be particularly clever but serves to give you a basic understanding of how to get data from ACE360 Connect and start manipulating it.

Next Steps

We'd recommend that you duplicate the report and experiment with checking for existing values, removing older unwanted data, and filling out more than one table. You could even start experimenting with our API filters to trim down the data you receive from Connect.

Need Inspiriation?

We've got an automated email guide coming soon!

Are you a PowerBi user?

Check out our basic PowerBi report tutorial.