acumatica Creating Date and Time Fields in Acumatica The PXTimeList Attribute


Example

The PXTimeList attribute is designed to work with a DAC field of the Nullable<int> (int?) type and store time span value inside a DAC field as a number of minutes:

#region UsrTimeSpan
public abstract class usrTimeSpan : IBqlField
{ }

[PXDBInt]
[PXTimeList]
[PXUIField(DisplayName = "Time Span")]
public int? UsrTimeSpan { get; set; }
#endregion

In the UI, for a field decorated with PXTimeListAttribute the system creates a drop-down with 30-minute interval values both on a form:

enter image description here

<px:PXTimeSpan ID="edUsrTimeSpan" runat="server" DataField="UsrTimeSpan" InputMask="hh:mm" />

and within a grid cell:

enter image description here

<RowTemplate>
    ...
    <px:PXTimeSpan ID="edgUsrTimeSpan" runat="server" DataField="UsrTimeSpan" InputMask="hh:mm" />
    ...
</RowTemplate>
<Columns>
...
    <px:PXGridColumn DataField="UsrTimeSpan" Width="90px" RenderEditorText="True" />
...
</Columns>