Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX (Archived)

How to add custom drop down field in ProjTable

Posted on by Microsoft Employee

Hi Everyone,

I want to add custom drop down field in projtable>report sorting tab, which will works like sorting1 , 2 , 3.

after clicking on new field the lookup menu form should be open .

please see the attached image.

report-sorting.JPG

thanks & regards

*This post is locked for comments

  • Martin Dráb Profile Picture
    Martin Dráb 230,198 Most Valuable Professional on at
    RE: How to add custom drop down field in ProjTable

    Your screenshot shows that the table doesn't have data in a mandatory field with label "Fixed asset number". This doesn't seem to be related to any lookup.

    Regarding your code, it looks very different than what you showed us a while ago. I'm not sure which is correct and which should be ignored.

    If you use the debugger to debug your code, as you always should, you'll find that performFormLookup() will never get called, because eaindustrytype_pm never has any value. Also, calling performFormLookup() more than once wouldn't make sense, therefore it shouldn't be in any loop even if the loop worked.

    By the way, please use the </> button in the rich formatting view to paste source code; it will make it more readable. I've done it for you this time:

    public void lookup(FormControl _formControl, str _filterStr)
    {
        AssetTable assetTable;
        EAIndustryType_PM eaindustrytype_pm;
        Query query = new Query();
        QueryBuildDataSource qbds;
    
        SysTableLookup sysTableLookup = sysTableLookup::newParameters(tableNum(eaindustrytype_pm), _formControl);
    
        //Check that customer no is not blank.
        while (eaindustrytype_pm)
        {
            qbds = query.addDataSource(tableNum(eaindustrytype_pm));
            qbds.addRange(fieldNum(eaindustrytype_pm, AssetId)).value();
    
            sysTableLookup.parmQuery(query);
            
            // Specify the fields to show in the form.
            sysTableLookup.addLookupfield(fieldNum(eaindustrytype_pm, AssetId));
            sysTableLookup.addLookupfield(fieldNum(eaindustrytype_pm, ARCPercent));
            sysTableLookup.addLookupfield(fieldNum(eaindustrytype_pm, Industrytype));
            
            // Perform the lookup
            sysTableLookup.performFormLookup();
        }
    }
  • nmaenpaa Profile Picture
    nmaenpaa 101,156 on at
    RE: How to add custom drop down field in ProjTable

    To me it seems your form is broken. The lookup method should have no impact on the other records that you see in the grid.

    But in your screenshots the asset id on every record is now empty.

    Most likely your grid has some strange settings.

    What is the data source of your grid?

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: How to add custom drop down field in ProjTable

    Dear martin,

    i have switch the code from table to form level please see two snapshots.

    Picture one is the form and  second pic is the outcome(which is not showing any data for assetid when creating new entry)

    below is the code :

    pic 1 :

    no-data.JPG

    pic 2 :

    no-data.JPG

    public void lookup(FormControl _formControl, str _filterStr)

    {

    AssetTable assetTable;

       EAIndustryType_PM eaindustrytype_pm;

       Query query = new Query();

       QueryBuildDataSource qbds;

       QueryBuildDataSource QbdsJoin;

       // Instantiate sysTableLookup object using table which will provide the visible fields

       SysTableLookup sysTableLookup = sysTableLookup::newParameters(tableNum(eaindustrytype_pm), _formControl);

       ;

       //Check that customer no is not blank.

       while (eaindustrytype_pm)

       {

       // Create the query.

       qbds= query.addDataSource(tableNum(eaindustrytype_pm));

             qbds.addRange(fieldNum(eaindustrytype_pm, AssetId)).value();

     //  qbds.addRange(fieldNum(AssetTable, AssetId)).value(asse.CustomerNo);

     //  qbds.addRange(fieldNum(eaindustrytype_pm, AssetId)).value('EAKHIWS-322');

      // qbds.addRange(fieldNum(CustTrans, Allocated)).value('No');;

       // Set the query to be used by the lookup form

       sysTableLookup.parmQuery(query);

       // Specify the fields to show in the form.

       sysTableLookup.addLookupfield(fieldNum(eaindustrytype_pm, AssetId));

       sysTableLookup.addLookupfield(fieldNum(eaindustrytype_pm, ARCPercent));

       sysTableLookup.addLookupfield(fieldNum(eaindustrytype_pm, Industrytype));

       // Perform the lookup

       sysTableLookup.performFormLookup();

       }

    }

    thank you for your time

  • Martin Dráb Profile Picture
    Martin Dráb 230,198 Most Valuable Professional on at
    RE: How to add custom drop down field in ProjTable

    Is your method called at all? You didn't mention any code doing that. You can use the debugger to check whether code gets executed as expected.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: How to add custom drop down field in ProjTable

    okay thanks let me try and get back to you

  • Verified answer
    nmaenpaa Profile Picture
    nmaenpaa 101,156 on at
    RE: How to add custom drop down field in ProjTable

    And is your custom lookup method called at all?

    You need to override the lookup method of your form field and call your custom lookup method from there.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: How to add custom drop down field in ProjTable

    It is showing unfiltered data.

    please see the snapshot of my custom table.

    assettable.JPG

    my apologies for sharing incomplete information.

    thank

  • Suggested answer
    nmaenpaa Profile Picture
    nmaenpaa 101,156 on at
    RE: How to add custom drop down field in ProjTable

    So does it show unfiltered data from AssetTable or does it show nothing?

    Can you also share some screenshot of the data that you have in AssetTable, especially so that we can see the Asset group field in the screenshot as well?

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: How to add custom drop down field in ProjTable

    Means i am unable to view filtered data where assetgroup='computers'

  • nmaenpaa Profile Picture
    nmaenpaa 101,156 on at
    RE: How to add custom drop down field in ProjTable

    Just let  us know more details about what you mean by "it's not working" and maybe somebody can help.

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans