- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-03-2017 02:55 AM
When I collect data by using a daily job and a montly indicator the values for score_start and score_end are based on the first day of the month and the last day of the month.
How can I use the day for wich the data is collected..
excample
job collects daily for current month(october)
This means that the values for score_start =01-10-201700:00:00 and and score_end = 31-10-2017 23:59:59
And the day for the data collection = 04-10-2017
In this case I want to compare a date field with the collection date.
And this should also work when we do historical collection .
So this means that it is not the same as the current date, but should be the same as the data of the relative data collection
Solved! Go to Solution.
- Labels:
-
Performance Analytics
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-04-2017 03:25 AM
If i understand correct, you want:
- regular score_end for historic collection (ie 30-09-2017 23:59:59)
- current date time for MtD collection(ie. 04-10-2017 12:00:00)
I would recommend the following (I have not tested it):
var currentScoreEnd = Math.min(new GlideDateTime().getNumericValue(), score_end.dateNumericValue());
Use the currentScoreEnd variable in your script.
What this will do is pick the oldest of the 2 values, so if the score_end is in the future, it will return the current datetime.
If score_end is in the past, it will return the score_end value.
For readability, you might want to use a if statement.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-03-2017 01:24 PM
Marco,
>I collect data by using a daily job and a montly indicator
Why would you want this? Could you maybe use a daily indicator that has a condition like 'opened/updated/... this month' and use that in a daily collection job. The score_end will be 23:59:59 for the day that you collect (collecting for the month so far, with the fore-mentioned condition), so it works fine in historical scores collections.
Cheers, Pieter
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-03-2017 11:57 PM
Peter
This indicator was created to sum the outage time for open incidents per month.
To prevent double counting it was solved by using a monthly indicator.
This was at first no problem, but now we also want to show the current month, and this means that I need to know what the collection date is and not the current date.
I need this to be able to do a historical collection
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-04-2017 03:25 AM
If i understand correct, you want:
- regular score_end for historic collection (ie 30-09-2017 23:59:59)
- current date time for MtD collection(ie. 04-10-2017 12:00:00)
I would recommend the following (I have not tested it):
var currentScoreEnd = Math.min(new GlideDateTime().getNumericValue(), score_end.dateNumericValue());
Use the currentScoreEnd variable in your script.
What this will do is pick the oldest of the 2 values, so if the score_end is in the future, it will return the current datetime.
If score_end is in the past, it will return the score_end value.
For readability, you might want to use a if statement.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-04-2017 04:16 AM
Thanks Arnoud,
I compared the score_end date with the current date in my script,
In this case it solved my problem, but I can imagine that this does not always work
var scoreEndGO = score_end.getGlideObject();
var scoreEndGOCurrent = new GlideDateTime();
var scoreEndGDT = new GlideDateTime(scoreEndGO);
// mjo 04-10-2017 because of MTD request we had to check the current date STRY0089142
if(scoreEndGDT > scoreEndGOCurrent){ scoreEndGO = scoreEndGOCurrent; }
// mjo 04-10-2017 because of MTD request we had to check the current date STRY0089142
var scoreEndNV = scoreEndGO.getNumericValue();