編集

Compiler Warning AL0603

Note

The AL diagnostics topics are in preview. If you have input for this topic, we'd love to hear from you. Use our GitHub repo to create a PR and add content to this topic by going to here. To read about contributing, see Contribute to the Help. Thanks!

An implicit conversion is being performed from a value of type '{0}' to a value of type '{1}'. This conversion can lead to data loss and unexpected runtime issues.

How to fix this diagnostic?

This warning means AL automatically converts a value from one type to another, and the conversion could truncate data or lose precision. Typical cases are assigning a longer text to a shorter Text or Code, or narrowing a numeric type.

To fix it, make the conversion explicit and control the length or precision. The following example can lose data because the text can be longer than the target:

CodeValue := TextValue;

Use CopyStr to control the length:

CodeValue := CopyStr(TextValue, 1, MaxStrLen(CodeValue));

Get Started with AL
Developing Extensions