To check if a BLOB field has a value, you call its HASVALUE function. For example: IF Item.Picture.HASVALUE THEN;
In older versions, earlier than NAV 2009, you had to call CALCFIELDS before you could check HASVALUE, which – if you think of it, did not make much sense. This was changed in NAV 2009, so ever since that version you can check HASVALUE before you decide to call CALCFIELDS first. It makes all the sense – you don’t need to pull up to 2GB of data over just to see if anything is inside.
If you are an old-school guy (or just old, as me), and you CALCFIELDS first, HASVALUE next, maybe it’s time for you to reconsider it.
Rembember – the pattern is: IF Field.HASVALUE THEN Rec.CALCFIELDS(Field);
Any function that accepts only one parameter can be called as if it were a property, and this applies to built-in system functions, your own custom functions, and even .NET methods alike. Instead of doing it like Report50001.SetDefaultPostingDate(101015D) you can always do it like Report50001.SetDefaultPostingDate := 101015D. Of course you can improve semantics of your code significantly if you simply call the function PostingDate instead of SetDefaultPostingDate, then you can just write Report50001.PostingDate := 101015D;
Remember – this works for all function types, even .NET method calls.
If you want to rollback the database changes, but do not want the code execution to end, simply call ASSERTERROR ERROR(”); The ERROR(”) will quietly rollback the data changes, and the ASSERTERROR will capture the error, allowing the code execution to continue.
Use Labels (View > Labels) instead of data columns for captions in your reports. It’s amazing how much you save in terms of data transfer. And your Data Set looks better too. Microsoft, why don’t you use this consistently on your standard reports?
When testing the upgrade process, it’s a good idea to make a backup after every significant step, such as after importing Step 1 upgrade objects, after completing Step 1, after converting the database, and so on. This way you can always resume from the last meaningful point and save a lot of time, as compared to always running the whole process from the beginning.