Custom Code¶
From Admin -> Dashboard -> custom code execute the following actions
Write the syntactically valid code and to log results instead of print or debug use:
from custom_logger.utils import add_log
add_log(level=3, request=request, custom_message='MSG')
Valid variable:
"json_data", "drill_down_id_list"
For flat data:
{"custom_code_id": "flat_data_3"}
from kpis.models import KpiType
kpi_values_dirty, data_availabilities = KpiType.calculates_kpi_list_formula(
kpi_code_list=kpi_id,
selected_filters=filter_array,
log_message_manager=log_message_manager,
drill_down_id=drill_down_id_list[0],
group_by_period=False,
)
json_data['children'] = kpi_values_dirty
Finally, in the extra config of the graphs in dashboard generatore: {“custom_code_id”: 1}