> ## Documentation Index
> Fetch the complete documentation index at: https://docs.dify.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# List Operator

> Filter, sort, and select elements from arrays

The List Operator node processes arrays by filtering, sorting, and selecting specific elements. Use it when you need to work with mixed file uploads, large datasets, or any array data that requires separation or organization before downstream processing.

Supported input data types include `array[string]`, `array[number]`, `array[file]`, and `array[boolean]`.

<Frame caption="List Operator Node Interface">
  ![List Operator Node Interface](https://assets-docs.dify.ai/dify-enterprise-mintlify/en/guides/workflow/node/522a0c932aab93d4f3970168412f759e.png)
</Frame>

## The Array Processing Problem

Most workflow nodes expect single values, not arrays. When you have mixed content like `[image.png, document.pdf, audio.mp3]` in one variable, you need to separate this into focused streams that downstream nodes can process effectively.

The List Operator acts as an intelligent router, using filters to separate mixed arrays and prepare them for specialized processing.

<Frame caption="Array Processing Workflow Example">
  ![Array Processing Workflow Example](https://assets-docs.dify.ai/dify-enterprise-mintlify/en/guides/workflow/node/812d1b2f167065e17df8392b2cb3cc8a.png)
</Frame>

## Operations

### Filtering

Extract specific items based on their attributes. For file arrays, filter by:

<Tabs>
  <Tab title="Content Properties">
    **Type** - Filter by content category: image, document, audio, video

    **MIME Type** - Precise content type identification (image/jpeg, application/pdf, etc.)

    **Extension** - File extensions (.pdf, .jpg, .mp3, .docx, etc.)
  </Tab>

  <Tab title="File Properties">
    **Size** - File size constraints for processing limits

    **Name** - Filename patterns or specific names

    **Transfer Method** - Distinguish between local uploads and URL-based files
  </Tab>
</Tabs>

### Sorting

Organize filtered results by any attribute:

**Ascending (ASC)** - Smallest to largest values, A-Z alphabetical order

**Descending (DESC)** - Largest to smallest values, Z-A reverse order

### Selection

Choose specific elements from the processed array:

**Take First N** - Select the first 1-20 items after filtering and sorting

**First Record** - Return only the first matching element as a single value

**Last Record** - Return only the last matching element as a single value

## Output Variables

**result** - Complete filtered and sorted array for bulk processing

**first\_record** - Single element from the beginning, perfect for "primary" or "latest" item selection

**last\_record** - Single element from the end, useful for "most recent" or "final" selection

## Mixed File Processing Example

Handle workflows where users upload both documents and images:

<Frame caption="Mixed File Processing Workflow">
  ![Mixed File Processing Workflow](https://assets-docs.dify.ai/dify-enterprise-mintlify/en/guides/workflow/node/610358293217e54b55b7e1d4d16bf83c.png)
</Frame>

**Implementation Steps**:

1. **Configure Mixed Uploads** - Enable file upload features to accept multiple file types
2. **Split by Type** - Use separate List Operator nodes with different filters:
   * Filter for `type = "image"` → route to LLM with vision capabilities
   * Filter for `type = "document"` → route to Document Extractor
3. **Process Appropriately** - Images get analyzed directly, documents get text extraction
4. **Combine Results** - Merge processed outputs into unified responses

This pattern automatically routes different file types to appropriate processors, creating seamless multi-modal user experiences.
