---
title: "MDQueryGetAttributeValueOfResultAtIndex(_:_:_:)"
framework: coreservices
role: symbol
role_heading: Function
path: coreservices/1413046-mdquerygetattributevalueofresult
---

# MDQueryGetAttributeValueOfResultAtIndex(_:_:_:)

Returns the value of the named attribute for the result at the given index.

## Declaration

```swift
func MDQueryGetAttributeValueOfResultAtIndex(_ query: MDQuery!, _ name: CFString!, _ idx: CFIndex) -> UnsafeMutableRawPointer!
```

## Parameters

- `query`: The query.
- `name`: The attribute name to return the values of. If the attribute is not one of those requested in the valueListAttrs or sortingAttrs parameters to one of the query creation functions, the result will be NULL.
- `idx`: The index into the query's result list. If the index is negative or is equal to or larger than the current number of results in the query, the behavior is undefined.

## Return Value

Return Value The value of the attribute, or NULL if the attribute doesn't exist for the specified result.

## See Also

### Getting Query Result Values

- [MDQueryCopyValuesOfAttribute(_:_:)](coreservices/1413105-mdquerycopyvaluesofattribute.md)
- [MDQueryGetCountOfResultsWithAttributeValue(_:_:_:)](coreservices/1413009-mdquerygetcountofresultswithattr.md)
- [MDQueryGetIndexOfResult(_:_:)](coreservices/1413093-mdquerygetindexofresult.md)
- [MDQueryGetResultAtIndex(_:_:)](coreservices/1413055-mdquerygetresultatindex.md)
- [MDQueryGetResultCount(_:)](coreservices/1413008-mdquerygetresultcount.md)
- [MDQuerySetSortComparatorBlock(_:_:)](coreservices/1413021-mdquerysetsortcomparatorblock.md)
