How can I enable the function transformation capability in Cube.js REST API similar to what is done in the SQL API?

17 Views Asked by At

I noticed that the SQL API (Example Code 1) first calls sqlApiLoad, and the parameters at this step align with standard JSON parameters (Example Code 2). It converts the standard load into SQL to query data from the database (name, ct), and then performs functions like floor, char_length, etc., on the data in memory. Is it possible to achieve the same in the REST API, and how can I reuse this logic?"

code1:

SELECT
   char_length(name), floor(count(tc))* 2
FROM
  Orders
  group by name

code2

{
  "measures": [
    "Orders.tc"
  ],
  "dimensions": [
    "Orders.name"
  ],
  "segments": [],
  "limit": 50000
}

Is it possible to achieve the same in the REST API, and how can I reuse this logic?

0

There are 0 best solutions below