Totalling hours and minutes | XM Community
Skip to main content
Solved

Totalling hours and minutes

  • January 13, 2021
  • 4 replies
  • 100 views

Forum|alt.badge.img+5

Hi all,
I've created a matrix table question where users input the time a store opens and closes (below)
I'd like to be able to show them in a question underneath "you indicated that you are open for X hours a week, how many of these are staffed?"
What is the best way of being able to total the open hours? I'm assuming js of somekind but not sure where to start
many thanks in advance!
image.png

Best answer by ahmedA

You can use the code posted here.
This is a working demo for the same.

4 replies

Forum|alt.badge.img+22
  • Level 7 ●●●●●●●
  • Answer
  • January 13, 2021

You can use the code posted here.
This is a working demo for the same.


Forum|alt.badge.img+5
  • Author
  • Level 1 ●
  • January 14, 2021

https://www.qualtrics.com/community/discussion/comment/33366#Comment_33366ahmedA Thanks for this, but the demo doesn't work, it seems to have mm/dd/yyyy validation in place which doesn't accept hh:mm


Forum|alt.badge.img+22
  • Level 7 ●●●●●●●
  • January 14, 2021

Sorry for that. I was checking if they had any validation available for the HH:MM type...and selected that.
You can see the demo now.


Forum|alt.badge.img+5
  • Author
  • Level 1 ●
  • January 14, 2021

https://www.qualtrics.com/community/discussion/comment/33392#Comment_33392Thanks ahmedA I can see that working now! I'll save that code for future use!
Unfortunately I forgot to mention that this is within a loop and merge, and I can't seem to make it re-embed the data for each loop. I'm wondering if I'd be better trying to create some kind of horizontal constant sum instead