Display/Edit millisecond PLC durations

I have searched for a way to edit simple millisecond duration values in a PLC and can’t seem to find anything. I know how to display the millisecond durations as HH:MM:SS and have been able to edit the same duration values when extracted from a database and displayed in a Power Table. These values are stored in the database as “recipes”, but after selecting one and sending it to the PLC, I’d like to user to be able to edit the current “recipe” stored in the PLC.

They are durations, and not times, because the HH can be greater than 24. I’ve included a screenshot of 4 steps in the recipe - each step is a template. I’m currently displaying the values in the template using a Text Field and have tried a Formatted Text Field, but was not able to get it to work. I’m not real good at regular expressions. Is that the way to do this?

Off topic, but that screenshot looks suspiciously like its not in a flex view and is instead in a coord view. If that’s the case, then I would consider moving to a flex view as they are far better for form type applications like this with a table. Coord containers are really only good for p&id mimic pages. I recently did a project analysis the other day and found as I suspected, 80% of my Views were Flex, and only 15% were Coord for a power project.

Edit: re your actual problem, without a module to expose a component to handle this nicely, I would create a specific View template which takes in the ms value. Then I'd split it into its time components D H m s, display those in text input components which are styled to look like they’re one component. Let the user edit the individual time components independently, and convert it back into a ms value. I’m deliberately glossing over the details as I only have a phone at the moment…

2 Likes

The OP mentioned Power Table so I assume this is a Vision question.

2 Likes

In a Vision Power Table, you can configure columns to use a custom editor. Bunch of topics to review:

https://forum.inductiveautomation.com/search?q=tablecelleditor%20order%3Alatest

You probably want to wrap a JTextField with a formatter on edit start and a parser on edit complete.

The companion cell renderer would simply supply the formatted string on demand.

(Both suggestion presume the actual column value is the complete duration as an integer milliseconds.)

1 Like

I have pretty much foregone using tables for displaying data and have opted instead for creating a template as a “row” of the would-be table and use a repeater to make a much more flexible table. That flexibility would be easily utilized here as you could simply add fields to the row template that do the conversion in the background as the user enters the values.

Sigh.

I almost never use a template repeater, because a Power Table's customizations are so powerful. :man_shrugging:

Sure, but I already know how to make templates. I haven’t had much success customizing tables (yet, probably)