<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Assigning old timestamp to data point]]></title><description><![CDATA[<p dir="auto">I am looking to see if there is a script or function that will let let assign an old timestamp value to a point</p>
<p dir="auto"><img src="https://camo.nodebb.org/83a6d85ca46daf93ea11a884e00f2cb465117c39?url=https%3A%2F%2Fi.imgur.com%2FTvsekG8.png" alt="upload-d578a6cd-fba2-4a65-b425-70dc8190f277" class=" img-fluid img-markdown" /></p>
<p dir="auto">For example the point I am interested in was last logged at 11:32:05 and the other points last logged at 12:27:27.</p>
<p dir="auto">I would like to take the value 11:32:05 and eventually be able to export it to DGLux.</p>
<p dir="auto">My problem is the functions I have tried:</p>
<p dir="auto"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/valueOf" rel="nofollow ugc">https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/valueOf</a></p>
<p dir="auto">all return the current timestamp, if anything at all.</p>
<p dir="auto">Does anyone know of a function or script that will let me save this timestamp (11:32:05)?</p>
<p dir="auto">Bryan</p>
]]></description><link>https://forum.mango-os.com/topic/1914/assigning-old-timestamp-to-data-point</link><generator>RSS for Node</generator><lastBuildDate>Sat, 18 Apr 2026 00:34:23 GMT</lastBuildDate><atom:link href="https://forum.mango-os.com/topic/1914.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 08 Jul 2015 16:34:13 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Assigning old timestamp to data point on Fri, 21 Aug 2015 16:41:54 GMT]]></title><description><![CDATA[<p dir="auto">Here are some screen shots that might help.  First is a watch list containing the point containing the script (Time_Stamp) and the alarm that it is connected to (mal_cp_ol).  They have the same time stamp:</p>
<p dir="auto"><img src="https://camo.nodebb.org/6c5aae1d3eb27b808f49e4ef6175fd88dcd3d5e5?url=https%3A%2F%2Fi.imgur.com%2F7cAVMWy.png" alt="upload-d4d083ef-48fd-489b-98f8-f5faa56866a2" class=" img-fluid img-markdown" /></p>
<p dir="auto">Here is the script.  Perhaps I am not using it correctly:</p>
<p dir="auto"><img src="https://camo.nodebb.org/78e21cdcffd6e25e1da3c459c23b3125752da5d9?url=https%3A%2F%2Fi.imgur.com%2FER46GuD.png" alt="upload-8d9c0278-14fc-431d-8370-7bef2b054e7e" class=" img-fluid img-markdown" /></p>
]]></description><link>https://forum.mango-os.com/post/10225</link><guid isPermaLink="true">https://forum.mango-os.com/post/10225</guid><dc:creator><![CDATA[bryanh]]></dc:creator><pubDate>Fri, 21 Aug 2015 16:41:54 GMT</pubDate></item><item><title><![CDATA[Reply to Assigning old timestamp to data point on Fri, 21 Aug 2015 15:16:28 GMT]]></title><description><![CDATA[<p dir="auto">DGLux has limited capabilities as far as integrating with alarms and other parts of Mango.  Your best path forward is to figure out how to make that script work or why it isn't working.  We tested it on Mango 2.5 and it worked. It should work on 2.6 as well but we can take another look and see if the script needs to be modified.</p>
]]></description><link>https://forum.mango-os.com/post/10224</link><guid isPermaLink="true">https://forum.mango-os.com/post/10224</guid><dc:creator><![CDATA[JoelHaggar]]></dc:creator><pubDate>Fri, 21 Aug 2015 15:16:28 GMT</pubDate></item><item><title><![CDATA[Reply to Assigning old timestamp to data point on Fri, 21 Aug 2015 12:36:06 GMT]]></title><description><![CDATA[<p dir="auto">Here is a screen shot of the point in question in the point details page:</p>
<p dir="auto"><img src="https://camo.nodebb.org/3c139c5715430f247d1aaa950675066793466506?url=https%3A%2F%2Fi.imgur.com%2FXk0hFTJ.png" alt="upload-2cc7cc8b-f804-4523-82a3-887fbee503df" class=" img-fluid img-markdown" /></p>
<p dir="auto">However if I look at a watch list containing this point it displays the time as now, for example 8:37 am as of writing this</p>
]]></description><link>https://forum.mango-os.com/post/10222</link><guid isPermaLink="true">https://forum.mango-os.com/post/10222</guid><dc:creator><![CDATA[bryanh]]></dc:creator><pubDate>Fri, 21 Aug 2015 12:36:06 GMT</pubDate></item><item><title><![CDATA[Reply to Assigning old timestamp to data point on Fri, 21 Aug 2015 12:32:50 GMT]]></title><description><![CDATA[<p dir="auto">I have tried the script but it doesn't work.  However if I go in the data point details page for an alarm that is already active it says it become active on aug 10 10:37.  Is there a way to export that time to DGLux instead of the current timestamp of the point?</p>
]]></description><link>https://forum.mango-os.com/post/10221</link><guid isPermaLink="true">https://forum.mango-os.com/post/10221</guid><dc:creator><![CDATA[bryanh]]></dc:creator><pubDate>Fri, 21 Aug 2015 12:32:50 GMT</pubDate></item><item><title><![CDATA[Reply to Assigning old timestamp to data point on Sun, 26 Jul 2015 03:41:11 GMT]]></title><description><![CDATA[<p dir="auto">The script above now works in 2.6.0 beta as of build 353</p>
]]></description><link>https://forum.mango-os.com/post/10147</link><guid isPermaLink="true">https://forum.mango-os.com/post/10147</guid><dc:creator><![CDATA[Woody Beverley]]></dc:creator><pubDate>Sun, 26 Jul 2015 03:41:11 GMT</pubDate></item><item><title><![CDATA[Reply to Assigning old timestamp to data point on Thu, 09 Jul 2015 20:19:19 GMT]]></title><description><![CDATA[<p dir="auto">Hi Woody,</p>
<p dir="auto">Okay.  But you mentioned that this script does not work on the current beta version of Mango.</p>
<p dir="auto">But once that is updated I will try the new script.</p>
<p dir="auto">Bryan</p>
]]></description><link>https://forum.mango-os.com/post/10115</link><guid isPermaLink="true">https://forum.mango-os.com/post/10115</guid><dc:creator><![CDATA[bryanh]]></dc:creator><pubDate>Thu, 09 Jul 2015 20:19:19 GMT</pubDate></item><item><title><![CDATA[Reply to Assigning old timestamp to data point on Thu, 09 Jul 2015 18:04:10 GMT]]></title><description><![CDATA[<p dir="auto">Hey Bryan,</p>
<p dir="auto">Yeah that's what the script I wrote above kind of does.</p>
<p dir="auto">"This script returns the value of TestUpdatePtValue on every call but if the value is the same as the last time it uses the same timestamp."</p>
]]></description><link>https://forum.mango-os.com/post/10113</link><guid isPermaLink="true">https://forum.mango-os.com/post/10113</guid><dc:creator><![CDATA[Woody Beverley]]></dc:creator><pubDate>Thu, 09 Jul 2015 18:04:10 GMT</pubDate></item><item><title><![CDATA[Reply to Assigning old timestamp to data point on Thu, 09 Jul 2015 13:19:22 GMT]]></title><description><![CDATA[<p dir="auto">I have discovered another issue that needs to be solved.</p>
<p dir="auto">The points that I want to get the timestamp for are in a data source that updates every 2500 milliseconds.</p>
<p dir="auto">Even if I run the return p####.time script it returns the timestamp of the last update</p>
<p dir="auto">Is there a way to freeze the timestamp in the data source?</p>
<p dir="auto">Bryan</p>
]]></description><link>https://forum.mango-os.com/post/10108</link><guid isPermaLink="true">https://forum.mango-os.com/post/10108</guid><dc:creator><![CDATA[bryanh]]></dc:creator><pubDate>Thu, 09 Jul 2015 13:19:22 GMT</pubDate></item><item><title><![CDATA[Reply to Assigning old timestamp to data point on Thu, 09 Jul 2015 12:18:24 GMT]]></title><description><![CDATA[<p dir="auto">Thank you very much for your replies.  The script return p####.time works perfectly,</p>
<p dir="auto">Thank you for the script Woody.  For now I will move forward with Joel's suggestion but I will keep the script in mind.</p>
<p dir="auto">Thank you again</p>
<p dir="auto">Bryan</p>
]]></description><link>https://forum.mango-os.com/post/10107</link><guid isPermaLink="true">https://forum.mango-os.com/post/10107</guid><dc:creator><![CDATA[bryanh]]></dc:creator><pubDate>Thu, 09 Jul 2015 12:18:24 GMT</pubDate></item><item><title><![CDATA[Reply to Assigning old timestamp to data point on Thu, 09 Jul 2015 01:21:37 GMT]]></title><description><![CDATA[<p dir="auto">Hello Bryan,</p>
<p dir="auto">I think what you are looking for is this...</p>
<p dir="auto">'To explicitly set the timestamp of a value, set the TIMESTAMP context variable before your return statement. The value to which to set this variable must be milliseconds since the epoch (not a native date). For example:</p>
<p dir="auto">TIMESTAMP = new Date().getTime();<br />
return p.value + 1;*</p>
<p dir="auto">Here's a Meta Script example. In this example I'm monitoring a binary point named TestUpdatePtvalue that updates every 5 secs. This script returns the value of TestUpdatePtValue on every call but if the value is the same as the last time it uses the same timestamp.</p>
<p dir="auto">if (TestUpdatePt.value)<br />
ReturnValue = true;<br />
else<br />
ReturnValue = false;</p>
<p dir="auto">if ( ReturnValue == my.value ) {</p>
<pre><code>if (my.time &gt;0)   
   TIMESTAMP = my.time;
</code></pre>
<p dir="auto">}<br />
return ReturnValue;</p>
<p dir="auto">Now for the bad news, I just discovered that this script won't work in the 2.6.0 beta. We will get that fixed as soon as possible.</p>
]]></description><link>https://forum.mango-os.com/post/10101</link><guid isPermaLink="true">https://forum.mango-os.com/post/10101</guid><dc:creator><![CDATA[Woody Beverley]]></dc:creator><pubDate>Thu, 09 Jul 2015 01:21:37 GMT</pubDate></item><item><title><![CDATA[Reply to Assigning old timestamp to data point on Wed, 08 Jul 2015 19:28:02 GMT]]></title><description><![CDATA[<p dir="auto">Hi Bryan,</p>
<p dir="auto">Here are a few things that should help you understand the Mango Scripting environment a bit better.</p>
<p dir="auto"><a href="http://infiniteautomation.com/wiki/doku.php?id=automation:meta_data_points#context_objects" rel="nofollow ugc">http://infiniteautomation.com/wiki/doku.php?id=automation:meta_data_points#context_objects</a></p>
<p dir="auto">Script variables are objects.  So for example you could do<br />
<code>return p1.value;</code><br />
and this would return the current value of the point.  Or you could do:</p>
<p dir="auto"><code>return p1.time;</code></p>
<p dir="auto">This would return the current time stamp of the point.</p>
<p dir="auto">If you read through the rest of the wiki you'll see all the different properties of the objects</p>
<p dir="auto">Also see this section on time values: <a href="http://infiniteautomation.com/wiki/doku.php?id=automation:meta_data_points#time_values" rel="nofollow ugc">http://infiniteautomation.com/wiki/doku.php?id=automation:meta_data_points#time_values</a></p>
<p dir="auto">Let me know if this helps</p>
]]></description><link>https://forum.mango-os.com/post/10100</link><guid isPermaLink="true">https://forum.mango-os.com/post/10100</guid><dc:creator><![CDATA[JoelHaggar]]></dc:creator><pubDate>Wed, 08 Jul 2015 19:28:02 GMT</pubDate></item></channel></rss>