X++ was designed in a way that the complications around null value are not required and hence X++ manages a default value always to ensure that null exceptions do not occur. The null can however occur when there is a view defined with outer joins.
The obvious option it to handle this using SQL and a computed column in views. However in my case the columns were far too many to created a computed column for each and hence i wanted to handle null in the x++ code itself. I wanted to check if the value of a field in the view in null and accordingly take an action to either copy or ignore it.
the easiest way to do it, let x++ evaluate it on its own by placing it in round brackets. If the field is not null it would evaluate to true and in case of null it would evaluate to false.
employeeNewJoinedTmp.Grade = ( workerDetails.Grade) ? "" : workerDetails.Grade;
1 comment:
I have found great and massive information on. Thanks for sharing
Power BI Training
Power BI Course
Post a Comment