All posts by hougaard

Unable to compare operands of type …

Strange, I added a field to a table, everything compiled. But when modifying a record in the table I’m met with the following error:

Unable to compare operands of type NavCode with NavInteger?

This was in a NAV2018, late CU.

I have seen this kind of error before, usually because of objects not in sync (compiling everything will solve that)

The only change made, was that I added a single Text field.

The error is catch after the OnModify trigger. It’s not a debuggable piece of code that generates the error.

After several failed attempts to locate the source, I delete the field, recompiled everything, and added it again. Then everything worked?

Strange Day 🙂

p.s. Next time I’m gonna check the generated C# code …

 

 

There is a syntax error in a whitespace?

Today I was doing my daily dose of hacking, in this case, generating Javascript code from C/AL (Don’t ask). I had copy-pasted some Javascript into C/AL, converted it into strings and was met with this error when compiling:

A closer look quickly determined there’s NO syntax error, so what’s wrong?

The red line is kinda wide, and using some shift-cursor keys movement showed that this is one character:

But that is two spaces?

Ahh, mystery bug solved. You can paste TAB characters into C/AL, and they stay as tabs, but the compiler does not like them. Typing a tab gets translated into spaces, but not if you paste it in there, it just looks like 2 spaces but stays as one tab, that cannot be compiled.

Ctrl-H can actually search and replace the tabs with spaces, by copy’pasting the tab into the Find What field:

 

 

Clean up your Docker

Everybody who has started using Docker with Dynamics NAV and Business Central has seen their disk space vanishing over time.

Thankfully, there is a simple way to clean and reclaim your disk.

Use the command: docker system prune

This will DELETE the following:
– all stopped containers
– all networks not used by at least one container
– all dangling images
– all build cache

…. long list …..

The way I do this, is to start the containers I need and then run the command. As you can see, I just ran it, and reclaimed 60 GB of disk space.

DISCLAIMER: Don’t blame when you’re deleting something important!