In C/SIDE, certain built-in functions like FILTERGROUP support two (semantically equivalent) calling syntaxes. Either you say

MyRecord.FILTERGROUP(MyFilterGroupLevel);

or you use

MyRecord.FILTERGROUP := MyFilterGroupLevel;

I always forget that some of this compiler cleverness also applies to our own functions. Sadly, I don’t think you can make your own “properties” read/write like FILTERGROUP is, but this technique does allow you to build e.g. codeunits that feel more like object-oriented classes with properties (that are, in this case, either read-only or write-only. For an example of a situation where that is not a serious limitation, please read on).

A C/AL function that looks like this

SomeProperty(Value : Text)

can of course be called like this:

SomeProperty('Foo');

but this feels much more natural:

SomeProperty := 'Foo';

Note that your setter-functions should have exactly one parameter, and your getters should obviously have a return value defined.

Imagine for example a codeunit for building connection strings to connect to external databases. The different elements of the connection string can be set using write-only “property” functions, after which the resulting string can be retrieved from a read-only “property”, effectively encapsulating the knowledge about how to build connection strings. Using such a codeunit might look something like this.

 ConnectionStringBuilder.ServerInstance := 'MyDatabaseServerInstance';
 ConnectionStringBuilder.DatabaseName := 'MyDatabaseName';
 ConnectionStringBuilder.IntegratedSecurity := true;

 MESSAGE(ConnectionStringBuilder.ConnectionString);

Not rocket science, still nice. 😉