cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Your Friends List is a way to easily have access to the community members that you interact with the most! X

Is it possible to convert an integer to time?

acoosemans
12-Amethyst

Is it possible to convert an integer to time?

Hi all,

I would like to show how long a Test Session was in the "In Testing" state.

The DaysInState("In Testing") often returns a zero, so the precision of this info is insufficient.

The SecondsInState("In Testing") returns an integer, but no one reads in thousands of seconds. So, I need to convert this to a timestamp in days, hours, minutes, ... depending on the resolution. I can't seem to find a way to achieve this. Does anybody know?

Adriaan

1 ACCEPTED SOLUTION

Accepted Solutions

Hello @acoosemans,

 

i had a quick look at your problem and i think i have a solution using a computed field.

You need to create a short text field with the following computed expression:

 

Concat(ToText(floor(SecondsInState("In Testing")/3600)), Text(" Hours, ") ,ToText(mod((SecondsInState("In Testing")/60),60)),Text(" Minutes, "),ToText(mod(SecondsInState("In Testing"),60)),Text(" Seconds"))

 

You should get something like this (i had the time in seconds also displayed to check my result)

2017-07-25 08_53_37-Requirements Analyst ViewSet - Integrity 11.png

You still need to evaluate, if you want to recompute the field dynamic or static.

 

Regards,

Dominik

View solution in original post

7 REPLIES 7
kjain-2
15-Moonstone
(To:acoosemans)

Hi Adriaan,

There is some way that i found for this:-

1.) You can convert Seconds into hour from SecondInState Computation.

2.) sumTimeEntryByState("State-name") , you can use this function to calculate hour in current state.

But if you will calculate live it can affect your system performance, integrity calculate this every night, so calculating Days is always better option but may be you need this as per requirement. Kindly check and revert me back.

Regards

Kapil Jain

acoosemans
12-Amethyst
(To:kjain-2)

Thanks for the quick reply, Kapil.

I believe I need to use time entries to use the second option, right? We're currently not using that (yet).

For the first, do you mean I need to divide by 60*60 to get hours? I was hoping there was some function I could use to convert it to a neatly formatted timestamp (weeks, days, hours, minutes, ...).

I was indeed thinking to have it statically updated at night.

JensN.
13-Aquamarine
(To:acoosemans)

Hi,

 

maybe it's a bit too much, but you can use a trigger, which calculates once a day (or night) the seconds to a readable value and puts it into a date field? In trigger scripts you can use standard javascript functions like setTime() or such things.

 

And (this is just an idea without any proof) maybe this could go also with a similar function in a field computation?

 

cheers, Jens

Hello @acoosemans,

 

i had a quick look at your problem and i think i have a solution using a computed field.

You need to create a short text field with the following computed expression:

 

Concat(ToText(floor(SecondsInState("In Testing")/3600)), Text(" Hours, ") ,ToText(mod((SecondsInState("In Testing")/60),60)),Text(" Minutes, "),ToText(mod(SecondsInState("In Testing"),60)),Text(" Seconds"))

 

You should get something like this (i had the time in seconds also displayed to check my result)

2017-07-25 08_53_37-Requirements Analyst ViewSet - Integrity 11.png

You still need to evaluate, if you want to recompute the field dynamic or static.

 

Regards,

Dominik

kjain-2
15-Moonstone
(To:D_Thierjung)

Hi @D_Thierjung

I really liked your computation actually i also did the same earlier but converted into Days and Hours but your computation rule is very precise and give very keen information...

But i have a question in my mind...

This computation gives us Time , up to Seconds and this computation get executed by system every seconds so how about system performance ?

As per my view on the same we can use Static Updation which gets updated once in a day rather then dynamic updation.

What you think on the same ? 

 

Regards,

Kapil

Hi @kjain-2

 

you raise exactly the point i made at the end of my example. You always need to evalute if you need static or dynamic computation depending on the customer needs.

In general i agree with you that it is preferable to use static updates (e.g. once per day) but it depends on your end users and how the use the computation results.

 

You could even do a bit of both. Use static updates once per day, but also add a check box or custom button to update the desired value on demand (maybe even display the time at which the computed value was last updated.)

 

Regards,

Dominik

kjain-2
15-Moonstone
(To:D_Thierjung)

Hi @D_Thierjung,

Completely agree with you...
And i think you are also taking care about system performance because during long usage of system it can affect system performance if we use dynamic and with static it is perfect...
But your computation is too good and gives us very keen information up to seconds level but if we use static then we are not using the beauty of your computation completely because this computation we always use with dynamic becaue only then we can feel real time calculation...
But really appreciate your computtaion... 🙂

 

Regards,

Kapil 

Top Tags