AX 7. QueryRangeFunctionAttribute as a replacement for SysQueryRangeUtil.

All of you are familiar with SysQueryRangeUtil class. It is really helpful when you need to use custom query ranges with AOT queries or advanced form filters (see TechNet for examples). However it is a part of Application Platform model now and you won’t be able to add new methods there soon, because this model will be locked for overlaying.

New QueryRangeFunctionAttribute is introduced to replace it. Now we can mark any public static method with this attribute and it becomes available everywhere you used to use SysQueryRangeUtil class. Let’s have a look at code example and its usage:

/// <summary>
/// Retrieves a list of field IDs that are valid inventory dimensions parameters.
/// </summary>
/// <returns>String representing a list of field IDs.</returns>
[QueryRangeFunctionAttribute()]
public static str includedFieldIds()
{
    Set             validFieldIds   = InventInventoryDimensionsParametersEntityHelper::getValidInventoryDimensionsParametersFieldIds();
    SetEnumerator   enumerator      = validFieldIds.getEnumerator();
    str             value;

    while (enumerator.moveNext())
    {
        value = queryRangeConcat(value, enumerator.current());
    }

    return value;
}

Untitled

As you can see, syntax is slightly changed, previously you should specify only method’s name and now you need to add class name as well, because any class can have such method.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s