DRILLFACTS select_statement RETURN fieldname1, ... %ORDER BY fieldname3, ...
select_statement is a statement that uses SELECT.
fieldname1, fieldname2, fieldname3, fieldname4, and so on are names of fields in the fact table class defined by the cube.
If you do not specify the RETURN clause, the query returns the IDs of the records.
The %ORDER BY clause is an InterSystems extension to MDX. This clause specifies how to sort the displayed records.
For additional details on RETURN and %ORDER BY, see DRILLTHROUGH Statement.
Internally, the system builds and uses an SQL query.
If the SELECT statement returns more than one cell of data, the listing shows only the fields associated with the first cell.
The first example does not use RETURN, so it uses the default listing as defined in the cube:
DRILLFACTS SELECT diagd.osteoporosis ON 0 FROM patients
The next example uses the RETURN clause:
drillfacts select diagd.osteoporosis on 0 from patients return dxcolor->dxcolor, dxage, dxpatgroup->dxpatgroup
# DxColor DxAge DxPatGroup
1: Orange 7 Group A
2: Red 11 Group B
3: <null> 30 Group A
4: Purple 58 Group A
5: Purple 62 None