At iFacto, we try to keep our product as up to date as possible. Which means that when there are some problems in the Cumulative Updates, we run into them fairly early.
As such, I have found a situation where the MESSAGE does not work as we are used too.
Update: Apparently this isn’t actually an issue, but as it has always worked. Read the extended update below the post.
The easiest way to explain the problem is to show you a little sample.
MESSAGE('SAMPLE1:\' + 'line1\line2\line3'); MESSAGE('SAMPLE2:\' + STRSUBSTNO('line1\%1','line2\line3')); MESSAGE('SAMPLE3:\' + 'line1\%1','line2\line3');
Let’s review the code. We basically should expect the 3 examples to print line1, line2 and line 3 on a new line right?
Sample one, just puts all the text into the message directly, sample 2 uses % variables through the STRSUBSTNO, sample 3 just ditches the STRSUBSTNO and puts the % parameter values directly into the MESSAGE parameters.
Let’s look at the actual results:
Was that what you were expecting?
It appears that the MESSAGE parameters is broken, which leads to backslashes not being interpreted as new lines.
I have already logged an incident at Microsoft. Hopefully, in the next Cumulative Update, the problem will be fixed.
For now, all we can do is either:
- Ignore the problem
- Ignore the Cumulative Update
- Use concatenation
- Use STRSUBSTNO
As guidorobben mentioned in his comment, this isn’t a new issue, but MESSAGE has always worked as this. Even after showing this initially to some colleagues, none of us had actually noticed that it has always been like this.
So, it appears that this post is no longer a bug report, but a description of how the MESSAGE works with backslash.