# Data Mapping cfxdm - dm:selectcolumns

**dm: selectcolumns:** This cfxdm tag allows the user to include or exclude columns using a regular expression format after retrieving the data from an extension's tag.

It is very useful when the user is dealing with many columns from an extension's tag and it simplifies columns select using either include or exclude or both options together

**dm:selectcolumns** synta&#x78;**:**&#x20;

* **include (**&#x6F;ptiona&#x6C;**):** Specify a column or columns in regular expression format to include matched columns.
* **exclude (**&#x6F;ptiona&#x6C;**):** Specify a column or columns in regular expression format to exclude matched columns.

### Example 1: Select matched columns using the include option

&#x20;Selectcolumns functionality is captured in this example.

Step 1: Create an empty **dm\_selectcolumns\_example\_1** using AIOps studio as shown in the below screenshot.

![Empty pipeline](/files/-MellhmjlAm5F5qm6-Mo)

Step 2: Add the following pipeline code/commands into the above-created pipeline as shown in the below screenshot:

You can copy the below code into your pipeline and execute that in your environment.\
\
\&#xNAN;*`##### This pipeline creates a set of records/dateset details coming from a vCenter`* \
*`##### environment. This dataset includes datastore details, Folder name, guest_hostname,`* \
*`##### guest_ip_address.`*\
\
*`######  This pipeline uses dm selectcolumns to select user provided column names`*\
*`#####   and prints the output.`*\
\
*`@dm:empty`* \
*`--> @dm:addrow datastore = 'CFX-QA-Store-NFS-qnap' & Folder = '' & guest_full_name = 'CentOS 4/5/6/7 (64 bit)' & guest_hostname = 'test2.oia.cloudfabrix.com' & guest_ip_address = '10.95.134.17'`* \
\
*`--> @dm:addrow datastore = 'CFX-QA-Store-NFS-qnap' & Folder = 'User VMs' & guest_full_name = 'CentOS 4/5/6/7 (64 bit)' & guest_hostname = 'qa.oia.cloudfabrix.com' & guest_ip_address = '10.95.122.13'`*\
\
*`--> @dm:addrow datastore = 'ENG_ISOs,netapp-qa-nfs' & Folder = 'User VMs,Ravi-Pisupati,TestVMs' & guest_full_name = 'Ubuntu Linux (64 bit)' & guest_hostname = 'ubuntuqa' & guest_ip_address = '10.95.102.172'`*\
\
*`--> @dm:addrow datastore = 'datastore1 (6)' & Folder = 'Ravi-Pisupati' & guest_full_name = 'CentOS 4/5/6/7 (64 bit)' & guest_hostname = 'elkstack' & guest_ip_address = '10.95.121.218'`*\
\
*`--> @dm:addrow datastore = 'datastore1-198' & Folder = '' & guest_full_name = 'Microsoft Windows Server' & guest_hostname = 'spdnode.adwinstack' & guest_ip_address = '10.95.132.4'`* \
\
*`--> @dm:addrow datastore = 'netapp-dev-nfs-01' & Folder = 'User VMs,Ravi-Pisupati,TestVMs' & guest_full_name = 'CentOS 4/5/6/7 (64 bit)' & guest_hostname = 'localhost' & guest_ip_address = '10.95.103.115'`*\
\
*`--> @dm:addrow datastore = 'netapp-dev-nfs-01' & Folder = 'User VMs,Ravi-Pisupati,TestVMs' & guest_full_name = 'CentOS 4/5/6/7 (64 bit)' & guest_hostname = 'localhost' & guest_ip_address = '10.95.103.115'`*\
\
*`--> @dm:addrow datastore = 'netapp-dev-nfs-02' & Folder = 'CFX-Drama,Capri-Demo' & guest_full_name = 'CentOS 4/5/6/7 (64 bit)' & guest_hostname = 'democloudp' & guest_ip_address = '10.95.122.212'`*\
\
*`--> @dm:addrow datastore = 'netapp-dev-nfs-02' & Folder = 'CFX-Drama,Capri-Demo' & guest_full_name = 'CentOS 4/5/6/7 (64 bit)' & guest_hostname = 'ravip-v201-platform' & guest_ip_address = '10.95.122.216'`*\
\
*`--> @dm:addrow datastore = 'netapp-dev-nfs-02' & Folder = 'CFX-Drama,Capri-Demo' & guest_full_name = 'CentOS 4/5/6/7 (64 bit)' & guest_hostname = 'cfxautomatesvc' & guest_ip_address = '10.95.125.116'`*\
\
*`--> @dm:selectcolumns include = 'datastore.*|guest.*'`*<br>

![Pipeline code added to empty pipeline](/files/-Mf-6pOUSBLrnLZJlkN6)

Step 3: Click verify button to make sure syntax and pipeline code is correct (as shown below)

![Pipeline code is verified using 'Verify' button as shown above.](/files/-Mf-7Ht70MpioCm1zdVl)

Step 4: Click execute button and execute the pipeline. RDA will execute the pipeline without any errors (as shown below).

![Execute pipeline screenshot -1 ](/files/-Mf-7hhfWsSg3MIYHrPA)

![Execute pipeline screenshot -2](/files/-MelqSVs6Sg8BkcCi-Lc)

Step 5: RDA uses the dm selectcolumns function to select 'datastore and also guest\*' based columns as shown in the below screenshot.

![Successful execution of pipeline using dm function 'dm:selectcolumns' and prints output ](/files/-MelrfSPA0yqN4h3gLhX)

### Example 2: Select matched columns using the include option and deselect columns using the 'exclude' option

The following pipeline captures this example.

You can copy the below code into your pipeline and execute that in your environment.\
\
\&#xNAN;*`##### This pipeline creates a set of records/dateset details coming from a vCenter`* \
*`##### environment. This dataset includes datastore details, Folder name, guest_hostname,`* \
*`##### guest_ip_address.`*\
\
*`######  This pipeline uses dm selectcolumns to select user provided column names`*\
*`#####   using include, exclude options and prints the output.`*\
\
*`@dm:empty`* \
*`--> @dm:addrow datastore = 'CFX-QA-Store-NFS-qnap' & Folder = '' & guest_full_name = 'CentOS 4/5/6/7 (64 bit)' & guest_hostname = 'test2.oia.cloudfabrix.com' & guest_ip_address = '10.95.134.17'`* \
\
*`--> @dm:addrow datastore = 'CFX-QA-Store-NFS-qnap' & Folder = 'User VMs' & guest_full_name = 'CentOS 4/5/6/7 (64 bit)' & guest_hostname = 'qa.oia.cloudfabrix.com' & guest_ip_address = '10.95.122.13'`*\
\
*`--> @dm:addrow datastore = 'ENG_ISOs,netapp-qa-nfs' & Folder = 'User VMs,Ravi-Pisupati,TestVMs' & guest_full_name = 'Ubuntu Linux (64 bit)' & guest_hostname = 'ubuntuqa' & guest_ip_address = '10.95.102.172'`*\
\
*`--> @dm:addrow datastore = 'datastore1 (6)' & Folder = 'Ravi-Pisupati' & guest_full_name = 'CentOS 4/5/6/7 (64 bit)' & guest_hostname = 'elkstack' & guest_ip_address = '10.95.121.218'`*\
\
*`--> @dm:addrow datastore = 'datastore1-198' & Folder = '' & guest_full_name = 'Microsoft Windows Server' & guest_hostname = 'spdnode.adwinstack' & guest_ip_address = '10.95.132.4'`* \
\
*`--> @dm:addrow datastore = 'netapp-dev-nfs-01' & Folder = 'User VMs,Ravi-Pisupati,TestVMs' & guest_full_name = 'CentOS 4/5/6/7 (64 bit)' & guest_hostname = 'localhost' & guest_ip_address = '10.95.103.115'`*\
\
*`--> @dm:addrow datastore = 'netapp-dev-nfs-01' & Folder = 'User VMs,Ravi-Pisupati,TestVMs' & guest_full_name = 'CentOS 4/5/6/7 (64 bit)' & guest_hostname = 'localhost' & guest_ip_address = '10.95.103.115'`*\
\
*`--> @dm:addrow datastore = 'netapp-dev-nfs-02' & Folder = 'CFX-Drama,Capri-Demo' & guest_full_name = 'CentOS 4/5/6/7 (64 bit)' & guest_hostname = 'democloudp' & guest_ip_address = '10.95.122.212'`*\
\
*`--> @dm:addrow datastore = 'netapp-dev-nfs-02' & Folder = 'CFX-Drama,Capri-Demo' & guest_full_name = 'CentOS 4/5/6/7 (64 bit)' & guest_hostname = 'ravip-v201-platform' & guest_ip_address = '10.95.122.216'`*\
\
*`--> @dm:addrow datastore = 'netapp-dev-nfs-02' & Folder = 'CFX-Drama,Capri-Demo' & guest_full_name = 'CentOS 4/5/6/7 (64 bit)' & guest_hostname = 'cfxautomatesvc' & guest_ip_address = '10.95.125.116'`*\
\
*`--> @dm:selectcolumns include = 'datastore.*|guest.*' & exclude = 'guest_full.*'`*<br>

RDA uses the dm selectcolumns function to select 'datastore and also guest\*' based columns and excludes 'guest\_full \_name' as shown in the below screenshot

![Successful execution of pipeline using dm function 'dm:selectcolumns' and prints output ](/files/-Mf-92W5gd0ZEQXIHSL9)


---

# 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-aiops-studio/examples-jupyter/data-mapping-cfxdm-dm-selectcolumns.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.
