Date and Time picker, time only?

tvm
2020-11-26
2020-12-01
  • tvm

    tvm - 2020-11-26

    Is there any way to configure a date and time picker to only be able to select the time of day, not the date as well? I have it configured with a TOD variable and a format string of HH:mm, and everything works fine, I basically just don't want to see the dropdown arrow with the date selector, which doesn't actually do anything when configured with a TOD variable.

     
  • m.prestel

    m.prestel - 2020-11-30

    Not to my knowledge. It is a date and time picker ;)

     
  • tvm

    tvm - 2020-11-30

    Yeah it just seems odd that you can configure it with a TOD variable, and then the date picker does nothing.
    Basically I'm trying to configure a time of day input field. Configuring it like %t[HH:mm] works except then the operator has to enter 'TOD#11:55', which is confusing. I could use a string input (%s), but then I have to convert to TOD if/when the input is valid, and the visualization can't convert variables on the input side, only in the "Text Variable" field.
    I guess I just figured there would be something built in.
    I can make it do what I want by drawing a rectangle over the dropdown arrow for the date selector, making it invisible. Maybe that's a bit of a hack, but it works.

     
  • m.prestel

    m.prestel - 2020-11-30

    So the problem is not that the normal rectangle does not support the input type, it is only the displayed text when entering a TOD is "confusing".
    And by "confusing" you mean that we would not now what a TOD is? Could he not know why a change is not excepted?

    In short you just want to have a rectangle input without the TOD prefix right?

    Best regards,
    Marcel

     
  • tvm

    tvm - 2020-11-30

    Basically, yes. It comes out of a service call I had, where the operator was trying to enter "11:55" into a text field configured as %t[HH:mm]. It wouldn't work because he had to enter it as "TOD#11:55". Which is not something the average operator is going to know, he just wants to enter a time

     
    • Morberis

      Morberis - 2020-11-30

      There are 2 ways that I've come up for this. The first is that the format that the time needs to be entered in is printed on the top of the dialogue window.

      The second is the use of concat and string variables. They enter the time as a string variables like 12h30m, then concat adds the formatting, then I convert it to a TIME or TOD variable type.

      Here's what that looks like. I'm sure there are better ways to do it but for my purposes this works well enough I haven't looked for a better way. I don't have any error checking unfortunately.

       

      Last edit: Morberis 2020-11-30
  • tvm

    tvm - 2020-11-30

    But I still want the error checking (which is present in the date and time picker) in case someone enters "99:88" or something

     
  • tvm

    tvm - 2020-12-01

    Thanks for the input. I ended up configuring the text field as %s, and referencing properties of type STRING in the function block. The visualization then calls the get/set functions of the property, which do the conversion and error checking for the input, etc.

     

Log in to post a comment.