# TOPIC: calculate an intervention duration

## calculate an intervention duration 2 years 6 months ago #96184

 ahchouch Offline Junior Lime Posts: 22 Karma: 0 0Hi I need to calculate the duration of an intervention in minutes. I have 04 numeric type questions standing for hour and minute of benginning and finish of intervention. Q1: Hour of incision Q2/ minute of incision Q3: Hour of closure Q4: minute of closure How can i do this with EM or JS? The main issue is to handle the negative difference between hours or minutes (IH 23 and CH 00 for instance witch should give 01 hour difference not -23!) Thanks in advance The administrator has disabled public write access.

## calculate an intervention duration 2 years 6 months ago #96185

 Ben_V Offline Platinum Lime Posts: 1486 Thank you received: 352 Karma: 95 I'm not sure if you already know that you can use as well a very smart "timepicker" question... It's the end of the good news because I have no idea if it can be easier to handle your calculation with this Benoît goo.gl/Bw5iM => Recherche GG dans le forum français (remplacer "exemple" dans la barre de recherche) goo.gl/WX8PH => GG search for english forum (Replace "example" in the search bar) goo.gl/IxiGu => Búsqueda en el foro en español (Cambiar "ejemplo" en la barra de... The administrator has disabled public write access.

## calculate an intervention duration 2 years 6 months ago #96187

 ahchouch Offline Junior Lime Posts: 22 Karma: 0 Thanks Ben I actually kept my 4 numeric type questions and tried some JS. I had first to set rules for calculating the duration according to hours and/or minutes of closure are superior or not hours and/or minutes of incision. (4 cases!) It worked fine. I just need to add an alert if one of the four fiels is empty. It seems simple but my knowledge of JS is less than basic! Heres' the JS`````` The administrator has disabled public write access.

## calculate an intervention duration 2 years 6 months ago #96189

 Ben_V Offline Platinum Lime Posts: 1486 Thank you received: 352 Karma: 95 I just need to add an alert if one of the four fiels is empty.Sounds like the 4 questions just have to be set 'mandatory' Remember that in the advanced settings of numerical input questions you can use the 'question validation equation' and 'question validation tip' to display a validation message... (!is_empty(1234X56X789.NAOK)) or any more complex rule...e.g.: ((!is_empty(1234X56X789.NAOK) && (1234X56X789.NAOK >= "0")) Benoît goo.gl/Bw5iM => Recherche GG dans le forum français (remplacer "exemple" dans la barre de recherche) goo.gl/WX8PH => GG search for english forum (Replace "example" in the search bar) goo.gl/IxiGu => Búsqueda en el foro en español (Cambiar "ejemplo" en la barra de... The administrator has disabled public write access. The following user(s) said Thank You: ahchouch
Moderators: ITEd
Time to create page: 0.141 seconds