7 Replies Latest reply on Jan 30, 2019 9:23 PM by Rick Davin

    Which format to use for setting Pi Vision start-/endtime URL parameters?

    Roger Palmen

      Hi all,

      I've been playing along with AF and PI Vision (all current versions) where in AF i create a display URL to call a PI Vision display. The clients however can have various regional settings, therefore the format of the timestamp should work in any setting.

      My first idea was: ISO8601. The AF Formula DR does allow to format a date using the .NET format specifier, and for ISO8601 this is "o" (Format('ChartStarttime', "o"); should work but this does NOT and this creates huge formatted strings, e.g.: 2019-01-11T05:00:00.0000000+01:00

      I did try other formats that should work, like "u", but they cause PIVision to throw internal server errors (in this case only an error when the starttime is specified, to add to the buggy situation, endtime works fine).

       

      Does anybody know a shorter format that works reliably?

        • Re: Which format to use for setting Pi Vision start-/endtime URL parameters?
          Roger Palmen

          I crafted "yyyy-MM-ddTHH:mm:ss" and that seems to work ok. But this is quite unsatisfying. Don't we have standards like ISO8601 or RFCxxx for just this purpose? I would expect specific standard formats should work in PI Vision (and of couse internal server errors are always a sign of trouble...)

          • Re: Which format to use for setting Pi Vision start-/endtime URL parameters?
            Rick Davin

            I can't resist wanting to chime in with 2 such legendary All Stars in the PI Community.  I see mention of AF Formula DR but see some syntax to suggest StringBuilder is at play as well.  Here's something I whipped up:

             

            Click on image to enlarge

            2019-01-30 15_22_47-Window.png

             

            Timestamp is the top level parent.  It's a DateTime but uses StringBuilder to provide a value, namely the local time.  Note there are subseconds thanks to the o formatting.

             

            ToWholeSeconds is also a DateTime but it uses a Formula to round to the nearest whole second.  The UOM=s is not required.  It's there for completeness, but s is assumed internally anyway.

             

            Timestamp|ToIso8601 is a string created by StringBuilder.  Note I use relative attribute referencing of .. to get its parent (Timestamp) which provides a DateTime value.  And I can indeed format that DateTime input as "o".

             

            Likewise ToWholeSeconds|ToIso8601 is also a string.  It's configured exactly like the previous.  The only difference is the relative parent attribute serving as the input value.  In this particular case, .. refers to ToWholeSeconds.

             

            Finally there is ToWholeSeconds|ToShorterFormat, again a string created by StringBuilder.  The input is also the relative parent attribute, which provides a DateTime value.  I use a custom date time format to produce a somewhat shorter string that eliminates subseconds.

            1 of 1 people found this helpful