UNPKG

@abaplint/core

Version:
17 lines 993 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.CDSAggregate = void 0; const _1 = require("."); const combi_1 = require("../../abap/2_statements/combi"); class CDSAggregate extends combi_1.Expression { getRunnable() { // CDSPrefixedName handles dotted paths with path filters e.g. a._Assoc[filter].Field // CDSArithmetics handles expressions like sum(A + B), max(A * 100) // fieldAsType handles avg(field AS type) / sum(field AS type) — SAP inline type coercion const fieldAsType = (0, combi_1.seq)(_1.CDSPrefixedName, "AS", _1.CDSType); const value = (0, combi_1.altPrio)(_1.CDSArithmetics, _1.CDSCast, _1.CDSCase, _1.CDSFunction, fieldAsType, _1.CDSPrefixedName, _1.CDSString, "*"); return (0, combi_1.seq)((0, combi_1.altPrio)("MAX", "MIN", "SUM", "AVG", "COUNT"), "(", (0, combi_1.opt)("DISTINCT"), value, ")"); } } exports.CDSAggregate = CDSAggregate; //# sourceMappingURL=cds_aggregate.js.map