This is a small issue I recently identified in Microsoft Dynamics NAV.
Last week I developed a function to do some email formatting and it compiled without any problem. Everything went very smooth without any issue until I call the developed function with the required parameters.
Once I compile the codeunit which has the function call this error popped up.
My first impression was I have missed the required parameters and I checked it. So my function definition and my function call has same number of parameters so I was confused about this message.
To demonstrate this issue I have created a very small function which take 2 decimal values in and then return the sum of it.
This is how my function definition would look like in the C/AL editor.
This definition means SumValue function take No01, and No02 as input parameters and as the output it return the TotalSum variable.
Nothing fishy..
As a next step I will call this function from the OnRun trigger of the codeunit.
So this is perfect, Isn’t it?
Function definition required 2 parameters and I am passing 2. So everything should be ok and this should get compiled without any error.
So here we go..
I get the same error when I try to compile and Save the codeunit. It cannot be a problem with my function call because I am providing all the required parameters. Then what is the problem with this tiny little function which take 2 values in and return the sum of it?
To see the problem go to the function declaration window.
There is a integer type parameter without a name and this is not visible in the function definition line of the C/AL editor.
Once I delete the empty line code get compile without a problem.
These are very small things which will create headache to programmers.
Thank you and Regards,
Tharanga Chandrasekara