HL7 VQQ_Q07 Virtual Table Query

HL7 message structure VQQ_Q07 groups and segments from HL7 v2.5.1 Hide structure

These are the generated groups and segments for the version selected at the top of the page. The article explains the workflow, and this panel follows the chosen HL7 version.

Message Structure

SegmentNameRequiredRepeatable
Message Header Yes No
Software Segment No Yes
VTQ Yes No
Table Row Definition No No
Continuation Pointer No No

VQQ_Q07 asks for data from a virtual table using the VTQ segment. The table is "virtual" because the receiver defines the logical table and selection rules, not because the sender gets to browse a database freely.

The usual response is tabular, often with an RDF/RDT-style response such as TBR_R08.

A small VQQ Q07 example

MSH|^~\&|PORTAL|CITYHOSP|LOOKUP|CITYHOSP|20260718150000||VQQ^Q07^VQQ_Q07|VQQQ070001|P|2.5.1 VTQ|QVT001|R|ACTIVE_CODES^Active code lookup^L|LOCAL_CODES^Local code table^L|Status^EQ^A RDF|3|Code^CE^20~Display^ST^60~Status^ID^8

What systems do with it

The requester names a virtual table and selection criteria. The responder evaluates those criteria against its agreed view of the data and returns rows in an agreed response message.

These queries are usually local. The same table name on two systems should not be assumed to mean the same thing unless the interface guide says so.

How to read the structure

MSH identifies VQQ^Q07^VQQ_Q07. VTQ carries the query tag, response format, query name, virtual table name, and selection criteria. Optional RDF can describe expected response columns. Optional DSC supports continuation.

Implementation traps

Do not expose arbitrary tables. Treat virtual table names as an allowlist of stable, documented query views.

Also define the response schema tightly. A virtual table query is only useful if the requester knows exactly how to parse the returned columns.

Reference notes

HL7 v2.3.1 Chapter 2 describes virtual table queries alongside embedded query language, stored procedure, display, and tabular query patterns. See the HL7 v2.3.1 control/query chapter.