Exercise: Spreadsheet robot

This exercise introduces the last robot implementation in this certificate of participation story, building on top of the previous exercise. The new requirement is to create a summary spreadsheet to help reporting on the certificates.

../_images/create-certificate4.svg

create-certificate.bpmn

Multi-instance to rows

Because multi-instance output element definition is really a FEEL expression, it could be used to wrap local variables from single sub process execution into map added into output collection.

{name: name, email: email, filename: filename}

Mapping a row in FEEL

While the example FEEL expression looks like it does nothing, actually it collects selected individual variables from its execution context ito a single map value:


Spreadsheet as in Excel

After all the “hard work” has already done in BPMN (to make the its variables easy to use), the new Create summary sheet robot is straightforward with the default RPA framework keywords:

*** Settings ***

Library    RPA.Robocorp.WorkItems
Library    RPA.Excel.Files
Library    Collections


*** Variables ***

${filename}    summary.xlsx


*** Tasks ***

Create summary sheet
    ${rows}=    Create List

    Set task variables from work item

    Should Not Be Empty    ${filename}    Summary sheet filename is missing

    Create Workbook   ${OUTPUT_DIR}${/}${filename}
    Append Rows To Worksheet    ${rows}  header=${True}
    Save Workbook

    Create output work item
    Add Work Item File    ${OUTPUT_DIR}${/}${filename}
    Save work item

Just remember proper input mapping for mapping doain specific participants into generic rows for a our generic robot code.

Resource summary

create-certificate.bpmn
../mockoon/workshop-achievement.dmn../mockoon/workshop-achievement.html
   ../mockoon/fetch-participants.zip
   ../email/create-certificate.zip
   summary-sheet.zip