Skip to main content
Answer

Displaying DateTime in PXSelector

  • November 7, 2022
  • 2 replies
  • 336 views

Forum|alt.badge.img+1

I would like to include the CreatedDateTime field in a PXSedlctor Dropdown, however I am having some challenges.

Initially I added some UI attributes to the standard CreatedDateTime field, this led to some confusing errors. So, I moved on to a non-priested read only field that would return the value of CreatedDateTime.

        [PXDateAndTime(DisplayMask = "G")]
public virtual DateTime? OrderSetDateTime { get { return CreatedDateTime; } }
public abstract class orderSetDateTime : PX.Data.BQL.BqlDateTime.Field<orderSetDateTime> { }

Using this method the date value shows but not the time. How would I show both in a single column?

 

Thanks 

Best answer by andriikravetskyi35

Hi,

I am not sure that it will help, but maybe add InputMask and DisplayMask in this way:

 

[PXDateAndTime(InputMask = "dd-MM-yyyy HH:mm:ss", DisplayMask = "dd-MM-yyyy HH:mm:ss")]    

 

or try to change attribute to :

[PXDBDate(PreserveTime =true)]

2 replies

andriikravetskyi35
Jr Varsity I
Forum|alt.badge.img+1

Hi,

I am not sure that it will help, but maybe add InputMask and DisplayMask in this way:

 

[PXDateAndTime(InputMask = "dd-MM-yyyy HH:mm:ss", DisplayMask = "dd-MM-yyyy HH:mm:ss")]    

 

or try to change attribute to :

[PXDBDate(PreserveTime =true)]


Leonardo Justiniano
Jr Varsity II
Forum|alt.badge.img+4

Hi @Leif 

Just to clarify, Do you want to add that field as a column on a selector while selecting any other value? If that is the case you just need to specify the columns in the selector:

[PXSelector(typeof(Search<...>),
typeof( column 1 ),
typeof( column 2 ),
typeof( orderSetDateTime ),
...
)]

Also if the masks suggested by @andriikravetskyi35  are defined, you will have that specific display in the listing.

 

If this suggestion does not make sense, please share more details of what you want to accomplish.