Skip to content

Tables - Display & Select

Common Use Cases

The primary way of displaying & selecting data in PPA tasks is using tables.

For example:

  • Reporting on members of a group (display)
  • Auditing failed logons (display)
  • Adding a user to a selection of groups (select)
  • Deleting a selection of firewall rules (select)

Most plugins contain display & select actions for doing these.

Displaying Records

Using display actions simply presents a table of data to the task operator.

Some plugins also support multiple tabs/sheets through a display_tabbed action.

These actions don't output any data back to the task.

Selecting Records

Using select actions presents a table of data, & prompts the task operator to make a selection.

You may need to do any of the following with the selection:

  • Get the number of selections

  • Supply the selections to another action

  • Get the first selection

To make this easier in a Playbook, all select actions output the same information.

Selection

The select result format provides easy access the information you need.

Each of the following keys can be used in your Playbook with no extra steps.

Contents

all: a list of selected records

first: the first selected record in (or null if nothing was selected)

total: the total number of selections

Examples

Checking Number of Results

This example uses the total key to finish the task early if no data was selected.

Access Number of Results

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
- active_directory.groups.search:
    search_params:
      sAMAccountName: Test*
  load:
    domain_controller: domain_controller
  save: search_results

- active_directory.groups.select:
    text: Select Groups
  load:
    groups: search_results.all
  save: selection

- ppa.ui.output_error:
    text: No groups were selected, goodbye!
  when: selection.total == 0

- exit:
    exit_code: 0
  when: selection.total == 0

Operating on Each Result

This example uses the all key to supply each selection into another action.

Use All Results

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
- active_directory.groups.search:
    search_params:
      sAMAccountName: Test*
  load:
    domain_controller: domain_controller
  save: search_results

- active_directory.groups.select:
    text: Select Groups
  load:
    groups: search_results.all
  save: selection

- active_directory.groups.delete:
  load:
    distinguishedName: loop.action.item.value.distinguishedName
    domain_controller: domain_controller
  sequence: selection.all