Question Status

Verified
Muhammad Yasir asked a question on 21 Apr 2013 1:06 AM

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,

Reply
André Arnaud de Calavon responded on 21 Apr 2013 5:46 AM

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.

Reply
Verified Answer
Martin Dráb responded on 21 Apr 2013 11:20 AM

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)]);
Reply
Muhammad Yasir responded on 21 Apr 2013 11:43 PM

Thank you very much Martin . It works :)

Reply
Verified Answer
Martin Dráb responded on 21 Apr 2013 11:20 AM

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)]);
Reply