====UNLAG==== ===Parameters=== ^Order^Name^Type^Desc^ |1|a|[[point list|point list]]|A list of points that have history| |2|b|[[const]]|A number of seconds to 'bump' the requested range| ===Returns=== Places an updated version of the [[point list|point list]] on the stack. ===Description=== This function is used to adjust the times in a set of points that contain history (ie. from a call to [[fGETHISTORY]]). Positive amounts will move the timestamps in the history **forward** in time, while negative amounts will move the results **backwards** in time. This function is normally used along-side [[fLAG]], when you want to compensate for a time-lag between assets. It's particularly useful in products such as Grafana, where you might be mixing channels of data from a variety of sources. //NOTE: For analytics purposes, you might find the [[samplestream:class_lagcorrectedquery|LagCorrectedQuery]] Python class or ARDI addon more useful if your lag is [[samplestream:data-driven lag|data-driven]].// ===Example=== If we want to mix several channels of data with different amounts of //lag//, we need to make sure that our resulting data all has the **same X axis**. If we run this query... 'Asset A' ASSET 'Power' PROPERTY VALUES {"range": "15 minutes"} 120 LAG GETHISTORY 'Asset B' ASSET 'Power' PROPERTY VALUES {"range": "15 minutes"} GETHISTORY APPEND We get a set of 2 different points with history. If we ran the query at 2:00 in the afternoon, **Asset A Power** would have data from 1:43 to 1:58 and **Asset B Power** would have data from 1:45 to 2:00. If we wanted to compare these points of data visually, we need to pull the time-stamps of data from Asset A forward so it matches the range of Asset B, letting us chart them on the same X axis. 'Asset A' ASSET 'Power' PROPERTY VALUES {"range": "15 minutes"} 120 LAG GETHISTORY 120 UNLAG This function gives you the //data// from 1:43 to 1:58, but with the //timestamps// from 1:45 to 2:00 - allowing you to synchronise the channels and compensate for the lag. ===See Also=== [[fLAG]]