Posted 14 September 2017, 7:19 pm EST - Updated 30 September 2022, 6:26 pm EST
[activereports_archive]I have two tables stored in SQL Server database: a table for wells, and the other is a table for readings of these wells, such that each well has a unique ID stored in Well_ID field in wells table, and at the readings table there are many readings for the same well and identified by the same Well_ID field. I am designing a report for the wells table and want to add a dynamic chart inside the report that is drawn based on data related to each well (from the readings table):
I want to draw a dynamic chart for any well based on data in readings table which contains Well readings like PH that also contains Well_ID field.
When building a chart, in the data source configuration, I could write an SQL query that takes data from the readings table. However, I am not able to calibrate it so it takes Well_ID from features.
The SQL query is like this
"Select PH_Reading from dbo.A.Well_Readings”
This query returns the data for all wells, and I am not able to set a Where clause that queries data for only the targeted well based on Well_ID
This is better elaborated in this example:
I want to design a report (rpx) that will be installed on wells layer, such that when it is run on a specific well (e.g. with ID W101) it queries the data from the readings table for W101 well, and based on this data the chart is drawn as shown in the attached screenshots
When the report is run for W102 well, the report should query the data for W102 from the readings table and draw the PH chart based on it as in the screenshots below, and the same can be done for any well that report is run for
My question is how to define such query in datasource section, that queries data from readings table based on the selected Well ID in the layer
Is there a way to do this?
Any help is highly appreciated
Kind Regards,
Hani[/activereports_archive]