Dynamic variable on a sql query graph

Hi,

I’m trying to generate a graph with a dynamic variable on a workspace.

I’m using the query below but it looks like I cannot use a variable (‘{{search1.selectedRecord.id}}’) in my query. Is there a way to achieve that? I would love to update a chart based on the output of a search field.

SELECT core_biomarker.measured_at AS key, ROUND(core_biomarker.value::NUMERIC, 2) AS value
FROM core_biomarker
WHERE core_biomarker.biomarker_definition_id = ‘66960949-a900-4839-8182-b013bb359af0’
AND core_biomarker.user_id = ‘{{search1.selectedRecord.id}}’
ORDER BY key;

Thank you for your help.

Max

Context

  • Project name: Tenure-Health
  • Team name: Operations
  • Environment name: stage

Hello @mxmk

Thank you for posting and welcome to the forest community

As stated in the documentation, this is not available to the django agent for now

This feature is only available from version 9.0.0 for Express/Sequelize and Express/Mongoose and version 1.4.0 for agent-nodejs.

Regards,
Nicolas

Hi @nbouliol ,

Thank you for your reply. Sorry I’ve missed that information on your documentation.

However, is there a way to add such a filter on the analytics tab of a collection? I’ve seen on your documentation that we could display a record specific chart using ‘?’ in our sql queries but I cannot make it work yet (see here). I might have made a mistake but I would like to make sure that this feature is well available for the django agent.

Best,

Max

Hello @mxmk

Sorry but this feature is also only available for the django agent

You can create an API chart

You can get the current record id from the request body : body["record_id"]

Thanks for your reply. I’ll try check with our dev team if they can help me create an API chart :slight_smile:

1 Like