It took me a while to troubleshoot this, but I kept on having a mapping return an empty string for some rows when I wasn’t expecting it.
A common pattern in my data migration is that I need to map a character column from a source system to target, but the target column is smaller than the source (e.g. going from a 255 char column to 40 char). For this particular migration, only the first 40 characters are relevant, so I thought I could do:
$0.TargetColumn = left($0.SourceColumn, 40);
However, I found that if a particular row has LESS than 40 characters (but is not blank), TargetColumn will be set to empty/null for that row.
Shouldn’t the desired/expected behavior of left(string, count) be that if the string has less than the specified, return the entire string? This is how most (if not all) Java, VB, etc. functions work.