Skip to main content

Delete items from wrist data

Power Automate Desktop calls a variable that can store multiple values.

This time, I will explain how to delete all of the items included or part from the list data.

When deleting (clearing) all items

If you delete all the list items, you can easily implement them by using the "Clear List" action.

Add a sample flow with copy and paste

As a sample, we have created a list with three items on the initial value, and prepared a flow to clear the contents.

Copy the following code and paste it on the edit screen of Power Automate Desktop to add the target action.

SET InitializedList TO ['itemA', 'itemB', 'itemC']
Variables.ClearList List: InitializedList ClearedList=> InitializedList

For the definition of a list with multiple initial values, please refer to the following page.

Power Automate Desktop and add action

  1. Enter "List Clear" from "Action Search".
  2. Enter the variable name in the list you want to delete all of the target list items.

I can get up an error

There is no error that is thrown by this action, so there is no need for error response.

When deleting part of the item

If you want to delete only some of the items in the list, use the action "Delete the item from the list".

Add a sample flow with copy and paste

As a sample, we have prepared a list with three items in the initial value, and a flow to delete the second item.

Copy the following code and paste it on the edit screen of Power Automate Desktop to add the target action.

SET InitializedList TO ['itemA', 'itemB', 'itemC']
Variables.RemoveItemFromList.RemoveItemFromListByIndex ItemIndex: 1 List: InitializedList NewList=> InitializedList

Power Automate Desktop is implemented

  1. From "Search for action", enter "Delete items from the list".
  2. Select the designation method to be deleted from the "Delete Standards for items".To delete the n -numbered data, select "Index".
  3. Enter the variable name in the list you want to delete to delete the target list item based on the specified deletion standard.

important point

When specifying an index, note that the number starts from 0

For example, if you want to delete the second item stored in the list, specify "1" for the index.

Available exceptions

If the specified "index" is out of the list, an error occurs. For example, if the number of items stored in the list is four, setting "4" or more in the index will result in an error.

If the value is specified instead of an index, an error occurs if the target value does not exist.