Skip to main content

I want to forcefully input Data in UpperCase Only

Hi @TeophelusJohannes18 

If it’s your custom field - I’d try first to change the setter:

        public string Field
{
get
{
return Field;
}

set
{
Field = value.ToUpper();
}
}

For standard field - you can create a Graph Extension, define an event handler (FieldUpdating) and change the case:

        protected virtual void _(Events.FieldUpdating<YourDac.field> e)
{
if (!(e.NewValue is string newValue))
return;

e.NewValue = newValue.ToUpper();
}

You could also go with the trigger in the database, but I’d say doing it in code is more preferable.


I can also see different solution for the similar question at the Stack Overflow, maybe you like it more.


Hi @TeophelusJohannes18,
You can use the InputMask property in your DAC declaration of the field to ensure that data is entered according to your desired format

You can use it lIke 

>PXDBString(6, IsKey = true, InputMask = ">CCCCCC")]


hope, it helps!


[PXDBString(6, IsKey = true, InputMask = ">CCCCCC")]

 

This


Thanks a lot, guys. It worked for me


Reply