I am using version 24.106.0018. I created a date field named UsrXYZ. Below is my code:
#region UsrXYZ [PXDBDate] [PXUIField(DisplayName="Date")] public virtual DateTime? UsrXYZ { get; set; } public abstract class usrXYZ : PX.Data.BQL.BqlDateTime.Field<usrXYZ> { } #endregion
However, in SSMS, it showed as below:
SELECT DATA_TYPE, CHARACTER_MAXIMUM_LENGTH, NUMERIC_PRECISION, NUMERIC_SCALE FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'RQRequisition' AND COLUMN_NAME = 'UsrXYZ';
I need a Date picker field. What am I doing wrong here?
Page 1 / 1
Hi @rashmikamudalinayake10,
I tested in two different tables/DACs and I couldn’t reproduce the issue. Below is the info of the field that’s being created in the DB,
If the issue is consistently reproducible, kindly share the steps to reproduce the issue.
Thanks & Good Luck.!
It's strange behavior. It's still the same, so I just made the customization on version 23.108.00201. It worked on that version, but it didn’t work on 24R1. I think there might be something wrong with my database, but I'm not sure.
Hi @rashmikamudalinayake10
Your field declaration in the C# DAC class doesn’t affect how the column is created in your database.
There are 2 ways of setting the field:
Add to the customization and publish;
Create manually in the database.
My best guess would be that you might create the field as nvarchar(25) using one of those 2 methods and then didn’t republish your customization to change the field.
I’d try to double-check the correct type of the field (first on the Database Scripts page of the Customization, and then use FIle → Edit Project Times to review the file with that column to make sure it also has type date).
If everything is correct - try Publish customization. It should change the field type. If not - try also Publish with Cleanup (this operation forces db changes even if the Customization Engine decided that they should be omitted).
If both Publish attempts failed - try the same customization on the fresh instance of the same version. This might not resolve the issue, but at least will show you if this is an instance/database issue or something with the build.
@rashmikamudalinayake10 I would be more interested in seeing your aspx code for that field.