Product: Mapping Manager & Transaction Manager
Error: Unable to export transaction. Error: "AddAndFillRow, CalcStr GetStrFuncResult:COPY(): Length cannot be less than zero. Parameter name: length"
Issue: Whenever you attempt to Export/Import a Transaction you receive an error informing you that the length cannot be less than zero while referencing the COPY() function.
Reason: A @COPY() function within your Mapping Manager Maps is attempting to perform a copy with an invalid parameter.
Note: Your error message will not be exact- as the system will report back your custom logic written and will report the Row/Field the error is being produced in.
The system should report the Row (xxx) and Column (xxx) the error is being produced in. In the below example Customer โ firstName is where the offending logic resides.
Row (customer) Column (firstName)
Solution
Since a @COPY() function has 3 parameters: @COPY(Token, Start, Length) - your 3rd parameter would be the length which your system is reporting as being less than zero.
Your length parameter needs to be greater than zero in order for the @COPY() function to work.
@INSTR()
If you're using an @INSTR() to calculate the length to copy, then you are most likely receiving the error because your @INSTR() is not finding the character you're searching for. Resulting in a 0 being produced.
You'll need to make sure to validate your @INSTR() first with an @IF_THEN_ELSE or similar function prior to using it within a @COPY() function.
rev 1/19/2023