# Select union field

Hotkey: Alt-Y

This command allows the user to select the desired union field. In the presence of unions, the decompiler cannot always detect the correct union field.

The decompiler tries to reuse the union selection information from the disassembly listing. If there is no information in the disassembly listing, the decompiler uses an heuristic rule to choose the most probable union field based on the field types. However, it may easily fail in the presence of multiple union fields with the same type or when there is no information how the union field is used.

If both the above methods of selecting the union field fail, then this command can be used to specify the desired field. It is especially useful for analyzing device drivers ([I/O request packets](http://msdn.microsoft.com/en-us/library/ff550694\(v=vs.85\).aspx) are represented with a long union), or COM+ code that uses [VARIANT](http://msdn.microsoft.com/en-us/library/ms221627.aspx) data types.

See also: [interactive operation](https://docs.hex-rays.com/9.0/user-guide/decompiler/interactive)


---

# 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.hex-rays.com/9.0/user-guide/decompiler/interactive/cmd_select_union_field.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.
