Hi, I did search for this but can’t find anything to help me work out what I am doing wrong here.
A simple action that updates a field (duration) with the value of an equation is not updating correctly.
I suspect a mismatch in field type, or timing or order but have tried everything I can think of.
Here is a very simplified test app, with screenshots below the table with the schema and details of the action I am having issues with.
https://s-i.knack.com/test-app-3s9fjei9efhu2022#work-timer-example/
Any help or direction on this greatly appreciated.
Thanks in advance,
Calvin.
A guess that others will have more experience with - I think it has something to do with trying to update a number field with the equation date/time output. You might need to change the equation output to a number, and there’ll might be a conversion to hours from milliseconds.
1 Like
Hello Calvin,
It works fine for me.
Using the below 2 fields little difference.
added conditional rule instead of updating when click
https://roberts.knack.com/farmers#check-time/
Regards,
Sunny Singla
1 Like
Thanks @BradStevens the output from that equation is already a number, in hours. I think that part is correct because the actual output of that field is always correct.
And Thanks @Sunny_Singla yes, I have updated my table to show a new field with a conditional rule to set it . However, it’s not a solution to my issue, because I need the Action to put the result in a number field that is editable, not a field generated by a conditional rule. I have updated my rules, still not working.
I think it is to do with the order those rules are getting processed in the “Stop” action link
maybe I need a delay timer in the action to give the field time to update?
Hello Calvin,
Try now. on below link.
Just added one extra step.
https://roberts.knack.com/farmers#check-time/
Just one extra step. assign this formula field value to new number field as before. and then when the user click on the stop timer then assign this new field value.
Thanks,
Sunny
1 Like
Thanks Sunny, yes that what I had in mine already and it does not seem to work.
Yours does not work either, I just tested:
Your example page also has something weird happening with the end times? they change by a month, not sure about what is going on there.
I really feel it could be to do with this: When “Stop” is pressed, the fields (your “Duration(hrs)” and my “Duration from conditional run” ) are being updated before the actual calculation field that they are dependent on has been updated.
I have also tried splitting my stop action into 2 parts, it now looks like this
Still does not work.
So my equations fields are always correct. I really think it has something to do with the action that is not updating the number fields derived from the equations or conditional fields;
Here is my current “Stop” action;
Any further suggestions greatly appreciated !
https://s-i.knack.com/test-app-3s9fjei9efhu2022#work-timer-example/
It’s showing in -ve due to the time zone difference.
See start time is greater than the end time.
It’s not changing Month it’s a day only. (mm/dd/yyyy). when you enter time manually then it shows time according to your browser. But when you try to update it update server time as we set in knack.
You created a lot of fields. Try to remove all fields and.
1 Like
Thanks for looking again Sunny, I really appreciate it.
OK, I have removed all excess fields - I am just testing 2 fields (via equation and via conditional rule)
I also changed app timezone to be an Australian timezone of Western Standard time with no DST and in the final implementation will also stopped the user from editing any times so there is no browser issue.
Here are my fields;
Noting that Both the Duration (eq) and Duration (from your conditional run) Work 100% of the time
However the stop action is not putting the correct result into the 2 Number fields (and I need the “Stop” action to set these, because I need to use them in equations later so I need them to be correct without having to refresh the record.)
Here is the stop action now:
here is the result;
Something else going wrong I think.
I have solved it. Here is an example:
https://s-i.knack.com/test-app-3s9fjei9efhu2022#better-work-timer/?view_15_sort=field_31|desc&view_19_sort=field_27|desc
Its an ugly workaround that involves making a connected child table 1:1 for each timer, called stopwatch, in which a record is created on timer form submission, and which the values are taken from at the time of the ‘stop’ action. An ugly solution, and overkill, but at least it works.