**Source URL:** https://general.veevavault.dev/vql/functions-options/toname.md

# TONAME()



By default, queries on documents use field labels instead of field names. In v20.3+, use the `TONAME()` function to use the field name when querying document fields:

* Use `TONAME()` with `SELECT` to retrieve the field name instead of the field label.

* Use `TONAME() `with  `WHERE` to provide the field name as the filter value.

<aside class="notice">When querying documents, it is best practice to use `TONAME()` in the `WHERE` clause to provide the field name as the filter value. This ensures that the filter works for all users, including those with localized labels in their Vault.</aside>
You can only use `TONAME()` in `documents` queries on the following document fields:

* Document lifecycle (`lifecycle__v`)

* Document lifecycle state (`status__v`)

* Type (`type__v`)

* Subtype (`subtype__v`)

* Classification (`classification__v`)

* All document `Picklist` type fields

## Syntax {#Syntax}

```
SELECT TONAME({field})
FROM {query target}
WHERE TONAME({field}) {operator} {value}

```

The `{field}` parameter must be the name of one of the supported fields.

## Query Examples {#Query_Examples}

The following are examples of queries using `TONAME()`.

### Query {#Query}

The following query filters by the `status__v` field name and returns both the field name and label:

```
SELECT TONAME(status__v) AS StatusName, status__v
FROM documents
WHERE TONAME(status__v) = 'draft__c'

```

### Response {#Response}

```
{
   "responseStatus": "SUCCESS",
   "responseDetails": {
       "pagesize": 1000,
       "pageoffset": 0,
       "size": 3,
       "total": 3
   },
   "data": [
       {
           "StatusName": "draft__c",
           "status__v": "Draft"
       },
       {
           "StatusName": "draft__c",
           "status__v": "Draft"
       },
       {
           "StatusName": "draft__c",
           "status__v": "Draft"
       }
   ]
}

```


---

**Previous:** [TOLABEL()](/vql/functions-options/tolabel)  
**Next:** [TRIM()](/vql/functions-options/trim)