====Complex AQL Queries==== ===Getting Assets of a Type=== 'Gearbox' OFTYPE //Gets a list of assets that have the Gearbox type - [[https://demo.optrix.com.au/s/ex/aql/api/query?query=%27Gearbox%27+OFTYPE|Sample]]// ===Getting History for All Assets of a Type=== 'Gearbox' OFTYPE 'Temperature' PROPERTY VALUES {"range": "10 minutes"} GETHISTORY //Gets a list of assets located inside the Southern Zone - [[https://demo.optrix.com.au/s/ex/aql/api/query?query=%27Gearbox%27+OFTYPE+%27Temperature%27+PROPERTY+VALUES+%7B%22range%22%3A+%2210+minutes%22%7D+GETHISTORY|Sample]]// ===Getting Assets In A Section=== 'Southern Zone' ASSET 'Location' RELATIONSHIP 'down' RELATED //Gets a list of assets located inside the Southern Zone - [[https://demo.optrix.com.au/s/ex/aql/api/query?query=%27Southern+Zone%27+ASSET+%27Location%27+RELATIONSHIP+%27down%27+RELATED|Sample]]// ===Getting Properties from Upstream Assets=== 'Transformer' ASSET 'Generated Power' RELATIONSHIP 'upi' RELATED 'Power' PROPERTY VALUES //Gets a list of assets located inside the Southern Zone - [[https://demo.optrix.com.au/s/ex/aql/api/query?query=%27Transformer%27+ASSET+%27Generated+Power%27+RELATIONSHIP+%27upi%27+RELATED+%27Power%27+PROPERTY+VALUES|Sample]]// ===Getting Properties Across a Sequence=== 'Wind Turbine #1' ASSET 'Sequence' RELATIONSHIP 'downi' RELATED 'Power' PROPERTY VALUES {"range": "1 hour"} GETHISTORY //Gets the power consumption for the last hour across each of the turbines, in the correct reporting order - [[https://demo.optrix.com.au/s/ex/aql/api/query?query=+%27Wind+Turbine+%231%27+ASSET+%27Sequence%27+RELATIONSHIP+%27downi%27+RELATED+%27Power%27+PROPERTY+VALUES+%7B%22range%22%3A+%221+hour%22%7D+GETHISTORY|Sample]]// ===Get Distinct Lists of Downstream Assets=== 'Optrix Wind Farm' ASSET 'Location' RELATIONSHIP 'ddown' RELATED ['Location' RELATIONSHIP 'ddown' RELATED] EACH EAT //Gets a distinct list of the assets directly inside each of the major sub-sections of the wind farm - [[https://demo.optrix.com.au/s/ex/aql/api/query?query=%27Optrix+Wind+Farm%27+ASSET+%27Location%27+RELATIONSHIP+%27ddown%27+RELATED+%5B%27Location%27+RELATIONSHIP+%27ddown%27+RELATED%5D+EACH+EAT|Sample]]// ===Continue Reading=== [[Excel and PowerQuery]]