HL7 QBP_Qnn Generic Query by Parameter
QBP_Qnn is the generic query-by-parameter structure. It is useful when the local reference data knows that the message is a QBP query, but the exact trigger event is a variable or site-defined value rather than a named profile like QBP_Q11, QBP_Q13, or QBP_Q21.
The important idea is that QPD names the query profile and carries positional parameters, while RCP controls how the answer should be returned. Some query profiles also include RDF when the response will be tabular.
A small QBP Qnn example
What workflow it represents
The sender has a specific question and the receiver has a documented query profile that says what QPD-1 means, what QPD-3 and later fields contain, and what response message should come back. You see this shape around local patient lookups, provider directory lookups, master-data checks, eligibility-like checks, and integration-engine enrichment calls.
The query tag in QPD-2 matters. The response should echo that value in QAK and usually in QPD, so the requester can match the answer to the original query even when several requests are active.
How to read the structure
MSH carries a local trigger such as Z99 while MSH-9.3 identifies the generic QBP_Qnn structure. QPD-1 identifies the query profile, QPD-2 carries the query tag, and QPD-3 onward are the profile-defined user parameters.
RCP tells the receiver whether an immediate response is expected, how many rows or records the requester wants, and sometimes how to sort or limit included segment groups. DSC appears when continuation is needed for a larger result set.
Implementation traps
The main trap is using QBP_Qnn as a shortcut for not writing a query profile. It still needs a contract. Both sides must know every QPD parameter position, datatype, repetition rule, and response shape.
Also be careful with optional RDF. If the response is a tabular response such as RTB_Knn, the column list becomes part of the map for the returned rows. If the response is segment-pattern oriented, RDF may not be the right shape at all.
Reference notes
HL7 Chapter 5 describes query-by-parameter as the later query model that separates the query definition from the response format. The local v2.5.1 QBP_Qnn structure contains MSH, optional SFT, QPD, optional RDF, RCP, and optional DSC.