# cfxdm - dm:sort

**dm:sort:** This cfxdm tag allows the user to sort the data for a given column(s) in ascending or descending order.

**dm:sort syntax:** It supports the below arguments

* **columns (mandatory)**. It accepts one or more column names. If more than one column is specified, use comma as a separator.
* **order (optional)**. Supported values are '**ascending**' or '**descending**'. When not specified, default applied sort order is 'ascending'

**dm:sort columns = 'COLUMN\_A,COLUMN\_B,..'**

OR

**dm:sort columns = 'COLUMN\_A,COLUMN\_B,..' & order = 'ascending/descending'**

In the below example, for a reference, we are going to use **VMware vROps** as an extension to query the data and ingest it into **dm:sort** tag for applying the sort capability.

Enter the below command to select **VMware vROps VM Summary tag (**\*vrops:**vm\_summary**). (In this example, vrops name is used as a label to identify VMware vROps extension and it's tags. The label is defined while adding the extension in cfxdx configuration file or through UI.)

```
tag *vrops:vm_summary
```

![](/files/-MVKX59QfqdHMCv6j6rB)

**Example 1:** Sort the selected column. (**ascending** order)

Get the data from VMware vROps VM Summary tag (**\*vrops:vm\_summary**) which includes some of the below columns, sort the data by '**datastore**' column.

**Column Names:**

* guest\_hostname
* guest\_ip\_address
* guest\_full\_name
* **datastore**
* ...

Below command queries the data from vROps vm\_summary tag and sorts the data by column name 'datastore' in **ascending** order. (when '**order**' (optional) param is not specified, it sorts in ascending order by default).

```
data --> dm:sort columns = 'datastore'
```

![](/files/-MVV9vKASsVNTwdT-pqf)

**Example 2:** Sort the selected column. (**descending** order)

Get the data from VMware vROps VM Summary tag (**\*vrops:vm\_summary**) which includes some of the below columns, sort the data by '**datastore**' column.

**Column Names:**

* guest\_hostname
* guest\_ip\_address
* guest\_full\_name
* **datastore**
* ...

Below command queries the data from vROps vm\_summary tag and sorts the data by column name 'datastore' in **descending** order.&#x20;

```
data --> dm:sort columns = 'datastore' & order = 'descending'
```

![](/files/-MVdaxQboXm2nJPnODS-)

**Example 3:** Sort the selected multiple columns. (**descending** order)

Get the data from VMware vROps VM Summary tag (**\*vrops:vm\_summary**) which includes some of the below columns, sort the data by '**guest\_full\_name**' and '**datastore**' columns.

**Column Names:**

* guest\_hostname
* guest\_ip\_address
* **guest\_full\_name**
* **datastore**
* ...

Below command queries the data from vROps vm\_summary tag and sorts the data by both column names '**guest\_full\_name**' and '**datastore**' in **descending** order.&#x20;

```
data --> dm:sort columns = 'datastore,guest_full_name' & order = 'descending'
```

![](/files/-MVdeQS6EbCPNPexr8AO)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.cloudfabrix.io/rda/rda-userguide/rda-data-management-cfxdm/cfxdm-dm-sort.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
