AG Grid React: based on last updated time how can I display running time(e.g. how many minutes ago data changed) - ag-grid-angular

data: [{id:1, lastUpdatedTime: 23623636}]
let's say this record not changing in the back but on screen after first render I want to show last updated time as minute age, meaning as time goes by minute age(only that column) will increase like below (like we get older every seconds)
0 min
1 min
...
5 min etc
Display minute age instead of last updated and keep refreshing all the time

Related

How do I tell google sheets to only make a calculation after a certain time period?

Context
So I am currently building a database of data for financial assets to conduct some machine learning from to build trading signals. I am trying to calculate the geometric mean but over a given period (monthly). I want to tell google sheets to only calculate the geometric mean after every month. I tried using this formula to no avail:
=IF(last date of the month - first date of month = total days in a month,
GEOMEAN(filter(abs(range),abs(range)>0)),""))
** There were values in the last date of the month - first date of month = total days in a month **
It ended up doing it for every day for the 10 year data set.
** Update
This is the data:
Date Close Cleaned Data Returns Gross returns Geometric average returns
13/11/2015 280 -0.0267 0 1
16/11/2015 280 -0.0267 0 1
17/11/2015 280 -0.0267 0 1
...
23/12/2016 296.4 0.0236 -0.1561348935 0.8438651065
28/12/2016 295.2 0.0199 -0.0770931339 0.9229068661
29/12/2016 294.7 0.0183 0.03341318035 1.03341318
30/12/2016 294.9 0.0190 0.3718276303 1.37182763
Problem (UPDATE)
How do I create a function to let google sheet do calculations only for the last day of every month for a given time series data? Say within this time period, (1 year) I want to calculate the geometric mean for each month in this period and for new data I might want to add later in the future.
To do this you will have to set a trigger event. This is found within the script editor under the edit tab, second to last option.
Image of where to find the trigger manager: It's in spanish, but it will be found in the same place
Once there, click on add trigger, which will be found on the bottom right corner. The first option will ask you which function do you want to run from the bound script. Then select the source of the event and select according to time (My platform is in spanish so I'm trasnlating it you might have it written differently). Then it will prompt you: if you want it to be at an exact date and time, every minute, every hour, day, week and month. Select month and select the day of the month you want the trigger to happen in the next prompt and select the time for the last prompt, then click save.
Finding the last day of a month:
function lastdayOfMonths() {
let html='';
let td=new Date();
for(var i=0;i<12;i++) {
let dt=new Date(td.getFullYear(),td.getMonth()+i+1,0);
let dts=Utilities.formatDate(dt, Session.getScriptTimeZone(),"E MMM dd,yyyy");
html+=Utilities.formatString('<br />%s',dts);
}
SpreadsheetApp.getUi().showModelessDialog(HtmlService.createHtmlOutput(html), "Last Days of Months for next year");
}

Grafana: Convert text box(Template Variable) to integer

I've created a dashboard in grafana which shows the average availability and utilization of a machine. I also want to include the moving average and I've been asked to enable the user to determine the interval of the moving averagein weeks.
In order to do this I would like to use a text box template variable and convert it to an integer. The graphs are and the queries are grouped per days. The moving average is determined based on the average availability per day. Therefore, I would like to do this calculation on the template variable: ([[MA_interval]] * 7) - 1
My code looks like this:
Select AVG(avgAvailability) OVER(ORDER by day ROWS BETWEEN [[MA_interval]] PRECEDING AND CURRENT ROW) AS "Moving Average of Availability"
I would like to do this calculation on the template variable:
([[MA_interval]] * 7) - 1
Where [[MA_interval]] is the interval in weeks and 7 is the number of days in a week.
Could anyone help me out? I am using a MariaDB server as database.

Access 2016 Auto Increase Number then Reset to 1

First I apologize for any mistakes. I'm new to VBA.
I have a table (tblCustomers) with 3 fields that need to work together. The fields are JumpDate, Load, and Slot.
I am trying to have the Load and Slot increase from 1 to 12 as the orders are taken.
So If the JumpDate is equal to what is entered and Load is equal to what is entered then Slot +1 of last record with same date and Load up to 12 then resets to 1. Once the Slot reaches 12 then Load should increase by 1 up to 12. If both Load and Slot = 12 then message "All Loads Filled"
I am sure there is a way to do this I'm just not sure how. Any help is appreciated.

Time bands in a column in Report Builder 3.0

Take Datetime and give the half hour band it belongs to, irrespective of the date, just interested in the time.
There is as far as I can see, no time periods in SSRS, I need half hour time periods, that's 48 blocks in a day.
I would like to plot my data in bar chart,the interval for the bar width is along the x axis, the height is the occurrences on the y axis. I need an interval of half hour(the width of the histogram),I don't want to run some IIF/CASE statement, I would rather, convert the DateTime i have to a band on each row of data, what's the best way to output so I get half hour intervals along the X axis.
I don't want to run some IIF/CASE statement
By this I assume you mean you don't want 48 layers of IIF/CASE. Here's an SSRS expression that'll band a datetime just using a single IIF:
=DateAdd(DateInterval.Minute, 0-
IIF(Minute(Fields!DATETIMEFIELD.Value) <= 29, Minute(Fields!DATETIMEFIELD.Value), Minute(Fields!DATETIMEFIELD.Value) -30),
DateAdd(DateInterval.Second, 0-Second(Fields!DATETIMEFIELD.Value) ,Fields!DATETIMEFIELD.Value))
This removes the seconds from the time, and removes as many minutes necessary to get to the previous half-hour. You could likely use the same logic with different syntax as a column in your SQL query, if you prefer.
Use this calculated value for all the relevant parts of your SSRS chart.

MYSQL time diff

I'm trying to calculate time diff between two time fields. Because the fields are just time with no date, I can't use timestampdiff, so I'm using timediff() or subtime(). The only problem with those is when the second time is less than the first time, it returns a negative timediff for me. I understand it's taking the times as the same day times, but is there any way to get a behavior where it always calculates the time forward? For example, I have 23:00:00 and 07:00:00.
timediff('07:00:00','23:00:00') will return a negative value, because 23:00 is greater than 07:00, but I want to get 8 hours as the return. Is there any way I can do that?
You can achieve that with an if statement:
select if(dateA > dateB,
timediff(dateA, dateB),
addtime(timediff(dateA, dateB), '24:00:00.000000'))
This way, if the first date is smaller than the second, you add 24 hours to the difference.