Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Refer to the following API links for more in-depth info:

paste-code-macro
languagegroovytitleExample
def dmCtx = api.getDatamartContext()
def salesDS = dmCtx.getDataSource("SalesHistory2")
def dsQuery = dmCtx.newQuery(salesDS)

def filters = [
    Filter.equal("Sku", api.product("sku")),
]

dsQuery.select("SUM(Revenue)", "revenue")
dsQuery.select("SUM(UnitsSold)", "unitsSold")
dsQuery.select("YearMonth", "month")
dsQuery.where(filters)

def result = dmCtx.executeQuery(dsQuery)