Versions Compared

Key

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

Question

Why can't I query a column "ColumnNumber" if it is set as Integer in Data Source? I need to

...

aggregate by the first 4 columns, so I set the rollup to true. The first 4 columns are keys in the Data Source.

...

paste-code-macro
languagegroovy
def dmCtx = api.getDatamartContext()
def ds = dmCtx.getDataSource("SalesHistory")
def query = dmCtx.newQuery(ds, true)

query.maxRows = 20
query.select("Article")
query.select("SalesOrg")
query.select("BillingDocument")
query.select("BillingItem")
//query.select("ColumnNumber")    //  << Doesn't work: ColumnNumber is Integer
query.select("SoldTo")            //  << Works: SoldTo is Text
query.select("SUM(GrossSales)", "GrossSales")

"ColumnNumber" is filled in the Data Source.

...

hiddentrue

...

Answer

It is because in Pricefx numeric types (Integer, Quantity, Money) are not considered as types that you can group by. You can either change the column type to Text in the Data Source or create a Datamart with an expression column that casts the Integer column to Text.