web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Populating ListBox by column from table

(0) ShareShare
ReportReport
Posted on by

Hello!

I have found that in ListBox property I can set Data Source and Data Field. No less, the only fields can be added are in enum type.

1. How can I add full column from existing table?

2. Is there some event handler what to do when something is selected?

*This post is locked for comments

I have the same question (0)
  • Verified answer
    syed baber Profile Picture
    11,633 on at

    Hi,

    If you want to show values in a drop down stored in Table's column, then you can create a lookup using SysTableLookup and StringEdit control on form. Take a look at below link, it shows how to create a lookup using SysTableLookup:

    msdn.microsoft.com/.../hh185372.aspx

    Please let me know if you have further queries.

    Thanks,

    Baber.

  • Community Member Profile Picture
    on at

    Technically I'm making a wizard with three pages, first one should contain two listboxes/bomboboxes with the same data, second one with SysListPanelRelationTable, and third one with results.

    What should I type in this methods:

    sysTableLookup.addLookupField(fieldNum(CustTable, AccountNum));

    sysTableLookup.addLookupField(fieldNum(CustTable, CustGroup));

    Table I have do not contain any groups. And also, what is "AccountNum"?

  • Community Member Profile Picture
    on at

    After just unthinking pasting whole code into method I revived this error:

    The wrong number of arguments has been specified for the method.

  • syed baber Profile Picture
    11,633 on at

    You need to define and initialise the query variable. The code is mentioned in the link I specified above. Please follow the instructions in the link.

    Thanks,

    Baber.

  • Community Member Profile Picture
    on at

    Thanks for this idea, it used to be the thing I'm looking for.

    My certain issue it that the listBox (witch technically is stringEditBox) is not active.

    Receives good values and label, but I can't choose anything different than default (first on the list) value.

    Have you any suggestions what can be wrong?

  • syed baber Profile Picture
    11,633 on at

    What do you mean by it is not active? Can you please paste the code which you have used to populated the StringEdit control with values?

  • Community Member Profile Picture
    on at

    I didn't. In StringEdit properties I pointed data source, and then data field I want to.

    By not activated i mean not able to click on. It becomes more gray, like it would be read only or something. Event the arrow to open the list of content is disabled.

  • syed baber Profile Picture
    11,633 on at

    You must be missing something. Follow the code snippet as mentioned in the link I provided. It should work. You can also paste the code here and I will have a look.

  • Community Member Profile Picture
    on at

    I copied it from the website

    public void lookup()

    {

       Query query = new Query();

       QueryBuildDataSource queryBuildDataSource;

       QueryBuildRange queryBuildRange;

       SysTableLookup sysTableLookup = SysTableLookup::newParameters(tableNum(custTable), this);

       sysTableLookup.addLookupField(fieldNum(CustTable, AccountNum));

       sysTableLookup.addLookupField(fieldNum(CustTable, CustGroup));

       queryBuildDataSource = query.addDataSource(tableNum(CustTable));

       queryBuildRange = queryBuildDataSource.addRange(fieldNum(CustTable, CustGroup));

       queryBuildRange.value('40');

       sysTableLookup.parmQuery(query);

       sysTableLookup.performFormLookup();

       //super();

    }

    I have put it as a method under StringEdit.

  • Community Member Profile Picture
    on at

    My led have solve this issue.

    First of all there is too much of lines.

    Query query = new Query();

       QueryBuildDataSource queryBuildDataSource;

       QueryBuildRange queryBuildRange;

       SysTableLookup sysTableLookup = SysTableLookup::newParameters(tableNum(table_name), this);

       sysTableLookup.addLookupField(fieldNum(table_name, field_name));

       sysTableLookup.parmQuery(query);

       super();

    Secondly I set a data source instead of Extended Data Type.

    Now it works correctly.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans