Wednesday, August 31, 2011

Dynamic lookup on forms


To create a custom dynamic lookup on a form, override the lookup method on the control, and add the following code. This code allows you to select a year, but it should be clear what you need to modify to show something else:

public void lookup()
{
    Counter yearCount;
    List    valueList = new List(Types::String);

    for (yearCount = 0; yearCount < 5; yearCount++)
    {
        valueList.addEnd(strFmt("Year %1", year(SystemDateGet()) - yearCount));
    }

    SysLookup::lookupList(this, valueList, "List of years");
}

2 comments:

  1. Hi where is SysLookup::lookupList method please?

    ReplyDelete
    Replies
    1. Hi Donna. The blog post is very old and since then Microsoft has removed the mentioned method in the most recent versions of AX. Sorry.

      Delete