Question

Acumatica - Unable to show time in pxgrid

  • 13 July 2023
  • 0 replies
  • 53 views

 

I have a custom screen in Acumatica ERP 2022 R1, where I am importing excel. That excel has Specialized Test results. In that excel I have two columns StartTime and EndTime. These column are supposed to carry time values and in format HH:mm:ss. Now in my DAC the start time and endtime has been defined as int. See the codes below:

 

#region StartTime
public abstract class startTime : PX.Data.BQL.BqlInt.Field<startTime>
{
}
protected int? _StartTime;
[PXDBInt()]
[PXUIField(DisplayName = "Start Time")]
[PXTimeList()]
public virtual int? StartTime
{
get
{
return this._StartTime;
}
set
{
this._StartTime = value;
}
}
#endregion

 Similar code is for EndTime except names. Now while importing , if i am using time in my excel the code was giving exception that 12/31/1899 05:16:11 AM cannot be converted to time.

 

I drilled down and found that this exception is coming from FieldUpdating event of PXTimeList attribute, where the code is unable to parse date thus raising exception. So I decompiled the code and created custom attribute making some modification in FieldUpdating event. I added additional codes for parsing and it worked. After excel getting imported perfectly fine and value is getting stored as Integer, but here comes another problem while binding value on the grid column, its showing the value in integer for any random time values. For time ending with 30 or 00 its workign fine. Below are the screenshots

  1. Value in excel
  1. Value in PxGrid after importing

enter image description here

Also I did have some changes in aspx level

  1. Tried setting DisplayFormat ="t" in Customization Project Editor

  2. Converted DropDownlist to PXTimeSpan

  3. Added attributes

    <px:PXGridColumn DataField="EndTime" TextAlign="Right" CommitChanges="true" TimeMode="true" RenderEditorText="True"> </px:PXGridColumn>

    <px:PXTimeSpan ID="edchEndTime" runat="server" DataField="EndTime" InputMask="hh:mm"> </px:PXTimeSpan>

So I need you to help me fix this. I am burning my eyes since last two days.

 

Please do note, I cannot change DAC or Database fields or their data type. I need solution in the same code base only.


0 replies

Be the first to reply!

Reply


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2024  Acumatica, Inc. All rights reserved