I've run into this problem a couple of times. The CU is compiled and is running on live system.
when you design it, you see that
wrong expression
is written in Codeunit in certain area and would not compile.
I would have to find out what the actual code is and compile it again.
It mostly happens when a function is called.
Ahmed Rashed Amini
Independent Consultant/Developer
blog:
https://dynamicsuser.net/nav/b/ara3n
Comments
It happens when you change fieldnames ( making them longer ) used in the CU AFTER this CU has been compiled. It is then possible that when NAV decompiles the CU to show it on screen, the line doesn't fit anymore ( there is a maximum line length ) , and you get the "wrong expression" thing.
Example :
let's say ( just for the example ) that the maximum line length is 30 characters.
if you have this line : if you then change the fieldname in the original table to "Purchase Order No.", and you open the CU, the error will occur, because the line length has gone over the 30 characters !
Thanks.
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
I exported the code unit in text and it presents the same thing as in the C/AL editor, thought I could do something by exporting in .fob and reimporting into a plain Cronus database but it does the same as well.
Any idea what can be done?
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
My understanding is that there is some code "behind" the Wrong Expression line... Am I right? And if so, is there a way to recover it?
Thanks again.
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
I encountered this behavior making a manual .txt merge and importing the object with a line longer than 132 characters: in that case hopefully I kept the original source objects and manually modified the line.
Do you have a previous codeunit version to check?