Thank you Willvin for your help.
Regarding the chart, I have another question.
I have this query:
"SELECT f.year, SUM(f.revenue) AS sum_of_revenue FROM financials AS f WHERE (f.client_id =14 ) GROUP BY f.year"
And I want to make the chart to display on the client view page, so I need to use a dynamic value for the WHERE clause.
I've seen your recommendation in another post to use
<?php echo $data['field name goes here'] ; ? >
However I receive an error when I do this:
"SELECT f.year, SUM(f.revenue) AS sum_of_revenue FROM financials AS f WHERE (f.client_id = " . $data['id'] . " ) GROUP BY f.year"
The error is:
But when I add a CustomView component above the chart component and add as Customcode:
<?php echo $data['id'] ; ?>
It shows 14 (as it should). So the variable is not undefined.
How can I use data from the current record/view for the WHERE clause?