display date/time dependent on antother field
Hi there,
I want to show the current time in a calculated field on when a specific condition is true, otehrwise the field shall keep the time-value that was set before.
Example:
if (@Timer === "On") {
>> set time to current time and display time
}
else {
>> display time as it was set before (NOT current time)
}
How can I achieve that?
-
Hi Rainer,
this is exactly the challenge I'm trying to solve: I want to set / remember the time when a specific condition is met (without entering that time manually, therefor trying this in a calculation filed). Ideally, when a button was pressed, like:
if (@button == pressed) { remembereded_time = now; }
(since there is no such thing as a button, I will use the state of a category field, i.e. 'timer' On | Off')
I understand that the whole script is triggered each time any item is updated, So I have to make sure that the field 'remembered_time' is ONLY updated when my 'button' is pressed.
Does this make it more clear?
Stefan
-
Hi Stefan,
you need an additional date field, it's not possible to do these 2 calculations in one calculation field.
You can use Podio Flows for setting the "Rememberred time":
If category changes to "Whatever category" set the time in date field. And then use this value in the calculation field.@Timer === "On" ? moment().toDate() : @date field
Rainer -
Hi Rainer,
thx for the tipp with the flows.
With a combination of workflow actions and some calcualted fields I finally managed to create a simple time-tracking app that is linked to my projects and now even shows the sum of the time and costs spent up to date in the project app.
Great!!
Stefan
Please sign in to leave a comment.
Comments
6 comments