I'm trying to display the total hours spent on a project per day per team. I'm new to arcade so everything I've found hasn't quite worked for what I need.
The only time carrying attribute that I have is the date with time. From my research I've been finding that I need a separate time attribute?
Is there anyway that I can show this data?
If you need more info please let me know
Solved! Go to Solution.
To show a duration, you need a start and end time, which you'd be able to feed into the DateDiff function to get the hours.
DateDiff($datapoint['end_time'], $datapoint['start_time'], 'hours')
To show a duration, you need a start and end time, which you'd be able to feed into the DateDiff function to get the hours.
DateDiff($datapoint['end_time'], $datapoint['start_time'], 'hours')
I have added start and end times but still can't seem to get the difference to display. Do you have any more suggestions?
What does your expression look like? Hard to say why it's not displaying without seeing what's actually happening.
var startDate = Date($datapoint.timestart);
var endDate = Date($datapoint.timeend);
var age = DateDiff(endDate, startDate, 'hours');
return {
//textColor:'',
//backgroundColor:'',
//topText: '',
//topTextColor: '',
//topTextOutlineColor: '',
//topTextMaxSize: 'medium',
middleText: age,
middleTextColor: '',
middleTextOutlineColor: '',
middleTextMaxSize: 'large',
//bottomText: '',
//bottomTextColor: '',
//bottomTextOutlineColor: '',
//bottomTextMaxSize: 'medium',
//iconName:'',
//iconAlign:'left',
//iconColor:'',
//iconOutlineColor:'',
//noValue:false,
//attributes: {
// attribute1: '',
// attribute2: ''
// }
}
Are your fields actually dates? If so, you don't need to use the Date function.
PS - You may want to use Round or Text to format the output nicely.
Yes the time fields include the date and time. I'm using the start and end functions built in to survey123.
Unfortunately, it still isn't working for me 😭
Thank you so much for your help though!
Can you just confirm that it's a true DateTime field, and not text? I've had surveys store other datatypes as text in the past.
It is by date