Limiting UD String Field To A Set Number Of Characters

I have created a UD field that is a string x(13). The information that goes in to this field must always be 13 characters long. I believe I need to create an In-Transaction Data Directive for it but I cannot seem to ascertain which condition I should use. I am guessing it is ‘The custom code… condition is valid’.

Might anyone have some insight on how to go about this?

I’d opt for first running some custom code to ascertain the length of the input string and then set a local variable to true/false based on your results. Then, if your condition is met via a condition block checking the value of a variable (i.e. you set the local variable to “true”), either proceed with the update or throw an exception.

Create a variable called FieldLen.

Set FieldLen = YourUDField.Length

Add a condition to check the value of the variable

Throw exception on the condition not met.

1 Like

That worked like a charm! Thank you Mark. Very much appreciated. I knew it had to be something simple and straight forward!

1 Like