Question

Can you add, edit, or update table calculations in Looks via the API?

  • 14 July 2021
  • 0 replies
  • 68 views

Yes, you can update the query object associated with a Look. There's a property called dynamic_fields which you can use to add, update, or remove table calculations.

To get the logic for the table calcs, you can build a query with table calcs, open up Dev Tools, look at how Looker constructs the query in the Network tab and copy the logic into your API call.

 

The logic for this table calc:

if(${orders.count_pending}>500,"deficit","surplus")

 

is displayed in the Network tab as:

dynamic_fields: "[{"table_calculation":"table_calc_logic","label":"Table_calc_logic","expression":"if(${orders.count_pending}>500,\"deficit\",\"surplus\")","value_format":null,"value_format_name":null,"_kind_hint":"measure","_type_hint":"string"}]"

Expand query in the Network tab to get the full logic:

 

 

This content is subject to limited support.                

 


0 replies

Be the first to reply!

Reply