• Hello Fabrik Community

    Fabrik is now in the hands of the development team that brought you Fabrik for Joomla 4. We have recently transitioned the Fabrik site over to a new server and are busy trying to clean it up. We have upgraded the site to Joomla 4 and are running the latest version of Fabrik 4. We have also upgraded the Xenforo forum software to the latest version. Many of the widgets you might have been used to on the forum are no longer operational, many abandoned by the developers. We hope to bring back some of the important ones as we have time.

    Exciting times to be sure.

    The Fabrik 4.0 Official release is now available. In addition, the Fabrik codebase is now available in a public repository. See the notices about these in the announcements section

    We wish to shout out a very big Thank You to all of you who have made donations. They have really helped. But we can always use more...wink..wink..

    Also a big Thank You to those of you who have been assisting others in the forum. This takes a very big burden off of us as we work on bugs, the website and the future of Fabrik.

element for millisecond in time

Nagtegaal

Member
For a Sports website I am collcting and displaying achieved times on a race. In Sports it is quite common to store the millisecond. Just think about the world record of Usain Bolt for 100m. It is (as we all know:) 9.58s. In my case I only need one digit behind the second.

I am looking for the appropriate element to store this piece of data in. This is what I tried:
  1. The element - time plug-in has nice functionality, but does not support the milliseconds.
  2. I tried various formats with the date element, but I cannot find a way to enter the milliseconds.
  3. In MYSQL I created a table with TIME(1) field and 'imported' this into fabrik. In the list the times look fine, however there is no possibility to edit this field or add a new record with these times. Display is hh:MM:ss.S
upload_2019-10-29_15-4-20.png
trial 3: In form view editing is not possible.


Any help on this will be welcome.
 
Last edited:
After a night sleep I found a solution that works for microseconds. I thought I might as well post it, if ever someone ever runs into the same issue.

In the list I created the elements minutes, seconds and tenths (I only need 1 digit), which can be separately entered. From that I fill the time element 'tijd' with a trigger in the database. (A trigger I personally prefer over a calc field, just because I work a lot with SQL.) In the database table the type of the field is TIME(1).

The triggers I created in MYSQL:

CREATE TRIGGER `update_your_table_before` BEFORE UPDATE ON `your_table`
FOR EACH ROW BEGIN
SET NEW.tijd = cast(str_to_date(concat(NEW.minutes,":",NEW.seconds,".",NEW.tenths), '%i:%s.%f')as TIME(1));
END


CREATE TRIGGER `insert_your_table_before` BEFORE INSERT ON `your_table`
FOR EACH ROW BEGIN
SET NEW.tijd = cast(str_to_date(concat(NEW.minutes,":",NEW.seconds,".",NEW.tenths), '%i:%s.%f')as TIME(1));
END

In the list I hide the minutes, seconds and tenths elements and in the form view I hide the tijd element.

List View:

upload_2019-10-30_13-55-45.png

Form view:
upload_2019-10-30_13-57-38.png

In my case I do not need hours, but this can added in the same way (%H).
 
Last edited:
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top