Need help regarding SysLookupMultiSelectCtrl in X++

This question is answered

Hi,

I am facing a problem, i am using SysLookupMultiSelectCtrl class to create a multiselt lookup grid.The lookup contains two columns Code, Description.But the problem is that i want to show the values of the 2nd column (Description) on selecting a record from the grid.but this does,'t happen, it will always show the first column value (Code) when ever i select a record from the grid. My requiremnt is that i want to show the description on selection in the control.

Hope you aomeone might have a solution regarding that.

Thanks,

Verified Answer
  • It is supported, just not very intuitive and well-documented. The key is the last parameter of SysLookupMultiSelectCtrl's construct() - you have to provide a container with table ID and field ID (in this order). For example:

    SysLookupMultiSelectCtrl::construct(
        element,
        ctrl,
        queryName,
        false,
        [tableNum(Table1), fieldNum(Table1, Field1)]);

    Martin "Goshoom" Dráb | Freelancer | Goshoom.NET Dev Blog

  • Thank you very much Martin . It works :)

All Replies
  • Which version of AX are you using? In AX2012 you can have foreign keys with reference fields .

    In AX2009 or earlier, there is a sample showing a contact person name (customer form) in stead of the ID. But this requires an edit method as well.

    kind regards,

    André Arnaud de Calavon  |  Microsoft Dynamics AX Solution architect  |  My blog  |  My company

    This post is my own opinion and does not necessarily reflect the opinion or view of my company, Microsoft, both its employees, or other MVPs.

  • It is supported, just not very intuitive and well-documented. The key is the last parameter of SysLookupMultiSelectCtrl's construct() - you have to provide a container with table ID and field ID (in this order). For example:

    SysLookupMultiSelectCtrl::construct(
        element,
        ctrl,
        queryName,
        false,
        [tableNum(Table1), fieldNum(Table1, Field1)]);

    Martin "Goshoom" Dráb | Freelancer | Goshoom.NET Dev Blog

  • Thank you very much Martin . It works :)