/
Why is it not possible to query Integer column?

Why is it not possible to query Integer column?

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.

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.

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.

Related content

Why is SUM not working on Datamart query
Why is SUM not working on Datamart query
More like this
INTEGER Field as True Numeric Field & Dimension
INTEGER Field as True Numeric Field & Dimension
More like this
Can I query a Data Source directly?
Can I query a Data Source directly?
More like this
PA Query (SQL) Aggregate Functions
PA Query (SQL) Aggregate Functions
More like this

Found an issue in documentation? Write to us.