Skip to main content

Notifications

Microsoft Dynamics AX (Archived)

Adding fields to InventOnHand form in AX2012

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

I have added new fields to "InventTable" table and need to add these new fields to the form "InventOnHand" and make them available for filtering and sorting using the standard filter function in the form grid ("CTRL-G")

I have tried several approaches without luck.

1. Adding "InventTable" to the forms datasource and creating innerjoin with InventSum.

This resulted in new fields showing random data from the new tields in InventTable.

2. Adding the extra fields to the "InventSum" table and synchronizing them with the same fields from "InventTable"

Now I can see data in the table using tablebrowser, but the new fields then just appear as "Unretrieved" in the form.

funny enough I am also able to filter and sort data in the form using the new columns.

As far as I have discovered until now, the form datasource Query is rewritten every time by the "InventDimCtrl_Frm_OnHand" class in the "ModifyQuery" method (amongst others), so I have tried to modify this by using the "AddSortField" from the QueryBuildDataSource object for "InventSum"

This just results in some of the default fields showing up as "unretrieved" until I reset the "modifyQuery" method back to default

 

As I need to be able to filter and sort using the new data it is not an option to simply use display methods for the new data.

 

If anyone have done this with succes I would appreciate the help.

 

(please disregard the missing label-text in the last column :-) )

*This post is locked for comments

  • Suggested answer
    Randy33 Profile Picture
    Randy33 47 on at
    RE: Adding fields to InventOnHand form in AX2012

    Below is a step-by-step guide to add a new table/field to the On-Hand Inventory form.  

    FYI:

    As other users mentioned above, forms with this "dimensions" button have special grouping.  

    pastedimage1656354861803v1.png

    The on-hand form uses query InventOnhandDim. 

    pastedimage1656354886707v2.png

    STEPS: 

    Step 01:

    • Create a dummy table with two columns.  We will add this table's "ItemName" column to the form.  

    pastedimage1656354904795v3.png

    Step 02:

    • Insert a row into dummy table with values for one item (not shown). 

    Step 03:

    • Add dummy table to query. 
    • Note: This is incorrect (need to group the fields) but showing how "NOT" to do it for example sake.  A later step will do proper grouping.

    pastedimage1656354927507v4.png

    Step 04:

    • Add field to form's data grid (not shown). 

    Step 05:

    • Open form to test.  Notice the new column (from dummy table) does "NOT" have values.  We will correct this in steps below.

    pastedimage1656354972518v5.png

    Step 06: 

    • Now let's do it correctly.  
    • Convert the new "item name" field to a grouped "max" field.  This will resolve the blank value issue above. 

    pastedimage1656355004550v6.png

    Step 07:

    Sanity check…make sure a "relation" is defined to join dummy table inside the query. 

    • Forgetting the relation will cause the new form column to return blank/NULL values.  

    pastedimage1656355022514v7.png

    Done, value now shows OK.

    pastedimage1656355048880v8.png

    Couple extra notes:

    • Ignore the "group by" node.  Does not resolve the "blank value" issue above. 

    pastedimage1656355085795v9.png

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Adding fields to InventOnHand form in AX2012

    I'm also facing the issue similar to this,but my problem is i want to add invent sum field in on hand inventory form , but it showed as unretreived,it is a string field .i tried with solution explained her .

    i have wrote qbsSum.addGroupByField((Inventsum,fieldname)) in inventDimCtrl_Frm_OnHand class, modified query method.

    its working now,my question is .will it create any problem in grouping and all because of my piece of code?

    Awaiting for ur reply

  • ZBlackie Profile Picture
    ZBlackie 15 on at
    RE: Adding fields to InventOnHand form in AX2012

    I did just now, and it worked. Thanks!

  • RE: Adding fields to InventOnHand form in AX2012

    The above suggestions about adding the InventTable ds to the query and grouping on the necessary fields are sound. Have you tried that approach, Zach?

  • ZBlackie Profile Picture
    ZBlackie 15 on at
    RE: Adding fields to InventOnHand form in AX2012

    Has there been a confirmed way to do this? I'm having the same issue.

    Thanks,

    Zachary

  • Verified answer
    RE: Adding fields to InventOnHand form in AX2012

    If you add inventTable as a Datasource, you need to group by the fields you want to display, since the main datasource uses SUM functions (and group by functions).

    If you take a close look on INVENTDIM datasource, you will see that depending on your "InventDimParm" (Dimension Criteria) selection, the group by changes.

    Which means, add the Search Name fields and the other field to group by clauses and it should work.

  • Bilal Issa Profile Picture
    Bilal Issa 4,370 on at
    RE: Adding fields to InventOnHand form in AX2012

    Hi Jenson,

    in "InventDimCtrl_Frm_OnHand" class in the "ModifyQuery" method , please pass the inventtable data source and then wrote the following code

    QueryBuildDataSource    qbsSum = _inventTable_DS.query().datasourceTable(tablenum(InventTable);

    qbsSum .addGroupByField(FieldId);

    so you need the use addGroupByField   , to show them.

    Regards,

    Bilal

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Adding fields to InventOnHand form in AX2012

    Hi Bilal

    As I wrote in my initial post, it is the InventOnhand form and not the InventSum form that is bugging me.

    I have allready tried adding the fields using "AddSumField" in the ModifyQuery method on the "InventdimCtrl_Frm_Onhand" class with no luck..

  • Bilal Issa Profile Picture
    Bilal Issa 4,370 on at
    RE: Adding fields to InventOnHand form in AX2012

    Hi Bo,

    InventSum form uses InventSum::queryAddSumFields(inventSum_DS.query().dataSourceTable(tableNum(InventSum))) methode to init query , please t add your fields in that method.

    Regards,

    Bilal

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

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Congratulations to the January Top 10 leaders!

Check out the January community rock stars...

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,996 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,853 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans