Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested answer

Display Method on inventdim configid lookup (InventProductDimensionLookup Form)

(0) ShareShare
ReportReport
Posted on by 5

Hi All

In the stock dimension configid drop down, lookup l, I need to add a display method next to the configid (lets just say I want to reverse the configId from 12345 to 54321, this is just for an example)

I've added a display method to the InventProductDimensionLookup Form data source InventDimCombinationDimension

Display str WMPDisplayConfigName(InventDimCombination _inventDimCombination)

}

//do something with table buffer _inventDimCombination but it's empty!!!"
return ("ppppp");
}

and I've added the the field to grid

the display method is working and returning "ppppp" next to each configid.(see screen above)3808.configId.gif

the problem is the input parameter _inventDimCombination is empty, so i can't do anything useful.

I think InventProductDimensionLookup Form and It's Datasource are placeholders and are not instantiated in the normal way.

(none of the datasources executequery methods seem to be called except the first one inventdim)

I suspect the AX kernel is doing the work and what I'll need to do is modify the  inventDimCombination query that is being passed to the kernel ,to generate the lookup values.

Hopefully it will display additional fields if they are there.

I know I could use a custom lookup, but in this case I don't wish to do that, I want to use the stock dimension framework ie the InventProductDimensionLookup Form

Could someone help me a bit

Thanks

David H

  • Suggested answer
    DavidJohn Profile Picture
    5 on at
    RE: Display Method on inventdim configid lookup (InventProductDimensionLookup Form)

    SOLUTION

    1)in the declaration of the form i added a variable(FORM  is InventProductDimensionLookup)

    ItemId                      WMPglobalItemid;

    2)in the form method initdimensioncontrols I addeed

     wmpGlobalItemid = this.inventDimSetupObject().callerItemId();

    3)in the inventdimdimension datasource I added this method

    display Name displayConfigName(InventDim _inventdim)
    {
    EcoResConfiguration EcoResConfiguration;
    EcoResProductMaster EcoResProductMaster;
    EcoResProductMasterConfiguration EcoResProductMasterConfiguration;
    EcoResProductMasterDimensionValue EcoResProductMasterDimensionValue;
    EcoResProductMasterDimValueTranslation EcoResProductMasterDimValueTranslation;
    InventTable inventTable;
    InventDim inventdimIDD = formJoinedRecord(_inventdim, InventDimDimension_ds);

    select * from EcoResProductMasterDimValueTranslation order by EcoResProductMasterDimValueTranslation.RecId asc
    where EcoResProductMasterDimValueTranslation.LanguageId==currentUserLanguage()
    join RecId from EcoResProductMasterDimensionValue
    where EcoResProductMasterDimValueTranslation.ProductMasterDimensionValue == EcoResProductMasterDimensionValue.RecId
    join * from EcoResProductMasterConfiguration
    where EcoResProductMasterDimensionValue.RecId == EcoResProductMasterConfiguration.RecId
    join * from EcoResConfiguration
    where EcoResConfiguration.RecId == EcoResProductMasterConfiguration.Configuration
    && EcoResConfiguration.Name==inventdimIDD.configid
    join * from EcoResProductMaster
    where EcoResProductMasterConfiguration.ConfigProductMaster == EcoResProductMaster.RecId
    && EcoResProductMaster.DisplayProductNumber == wmpGlobalItemid;


    return EcoResProductMasterDimValueTranslation.Name;

    }

    4)I added a string edit field linked to the above data method to theTabPage:ctrlPageDimension::GRID

    What I don't like is having to do is "the below" in the Forms  initdimensionControls  method, I would like to move it into the body of the displaymethod, but can't figure out how to do it yet

    2)in the form initdimension controls I addeed

     wmpGlobalItemid = this.inventDimSetupObject().callerItemId();

    this method call "this.inventDimSetupObject().callerItemId();" seems to be out of scope when called from the inventdimdimension datasource (myNew Method=displayConfigName(InventDim _inventdim)

    thanks

    David

  • DavidJohn Profile Picture
    5 on at
    RE: Display Method on inventdim configid lookup (InventProductDimensionLookup Form)

    Hi All

    I tried making these changes marked by the (*****************) on Form InventProductDimensionLookup  method initDimensionControls()

    I added a string field to the design next to config field   auto declared as dimensionName2

    then in InitDimensionControls added

     dimensionName2.dataSource(InventDimCombinationDimension_ds.id());
     dimensionName2.dataField(fieldNum(InventDimCombination,ItemId));

    they are at bottom of the code.

    To try to pull through to the lookup the itemid from the InventDimCombinationDimension_ds

    but no luck there.

    private void initDimensionControls()

    {

       FormStringControl   dimensionControl;

       FieldId             dimFieldIdForLookup = this.inventDimSetupObject().parmMainSortFieldId();

       FieldId             retailFieldIdForLookup = this.getDimFieldIdForLookup(true);

       void moveControlToBeginning(Object _container, FormStringControl _control)

       {

           FormControl firstControl;

           do

           {

               _container.moveControl(_control.id());

               firstControl = _container.controlNum(1);

           }

           while (firstControl.id() != _control.id());

       }

       //make a dimension field (the one for we are looking up) a first field in the combination grid

       dimensionControl = this.findDimensionControl(gridCombination, dimFieldIdForLookup);

       moveControlToBeginning(gridCombination, dimensionControl);

       //make a dimension field (the one for we are looking up) a first field in the on-hand grid

       dimensionControl = this.findDimensionControl(inventoryDimensions, dimFieldIdForLookup);

       moveControlToBeginning(inventoryDimensions, dimensionControl);

       //Set up field for GridDimension

       if (isRetailLookup)

       {

           gridDimension.dataSource(retailDisplayOrderDimension_ds.id());

           dimensionName.dataSource(retailDisplayOrderDimension_ds.id());

           dimensionName.dataField(retailFieldIdForLookup);

       }

       else

       {

           dimensionName.dataSource(inventDimDimension_ds.id());

           dimensionName.dataField(dimFieldIdForLookup);

    //*******************  addition's for  lookup method  *********************************************

          dimensionName2.dataSource(InventDimCombinationDimension_ds.id());
          dimensionName2.dataField(fieldNum(InventDimCombination,ItemId));

         //********************************************************************************************  

       }

    }

  • DavidJohn Profile Picture
    5 on at
    RE: Display Method on inventdim configid lookup (InventProductDimensionLookup Form)

    configId.gif

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Jonas ”Jones” Melgaard – Community Spotlight

We are honored to recognize Jonas "Jones" Melgaard as our April 2025…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 294,120 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 232,866 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,158 Moderator

Leaderboard

Product updates

Dynamics 365 release plans