Using the String Length Setting When Creating a New Field

The String Length setting when creating a new field can be used to ensure that the resulting data type of the definition is "string", and also ensure that the length is a certain value.  

 

Typically, LityxIQ can figure out the field type and length on its own.  But there are a couple of instances where it will not always get it correct, and this is a way to help it along.  Two common cases where setting the String Length is recommended are:

 

CASE/WHEN Statements

Because evaluating the result of a case/when sequence can be complex, LityxIQ will not always guess a correct maximal expected string length from the sequence.  It is always recommended to specify the string length in case/when situations where you want the output to be a string.

 

SPLIT_PART Function

The SPLIT_PART function can also cause issues with LityxIQ correctly guessing the expected resulting string length, because the potential strings that Split Part will be asked to evaluate is out of its control.  Therefore, it is always recommended that you specify the string length when using the SPLIT_PART function.