Guest User

Untitled

a guest
Dec 13th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. <script runat="server">
  2.  
  3. var dataRows = Platform.Function.LookupOrderedRows('CountsDE2', 'Counts','Hour DESC',['Secret'],[1]);
  4.  
  5.  
  6. if (dataRows && dataRows.length > 0) {
  7.  
  8. var today = dataRows[0]["Hour"]; //Sets the most recent date
  9. var num1 = dataRows[0]["Count"]; //Sets the most recent count entry
  10. var num2 = dataRows[1]["Count"]; //Sets the previous count entry
  11. }
  12.  
  13. var growthRaw = (num2 / num1) * 100;
  14. var growth = (growthRaw).toFixed(2) + '%';
  15.  
  16. var rows = Platform.Function.UpdateData("CountsDE2",["Hour"], [today],["Growth"],[growth]);
  17.  
  18. </script>
Add Comment
Please, Sign In to add comment