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)

Adding fields to InventOnHand form in AX2012

(0) ShareShare
ReportReport
Posted on by

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

I have the same question (0)
  • Bilal Issa Profile Picture
    4,370 on at

    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

  • Community Member Profile Picture
    on at

    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
    4,370 on at

    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

  • Verified answer
    Gustavo Bagno Profile Picture
    on at

    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.

  • ZBlackie Profile Picture
    15 on at

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

    Thanks,

    Zachary

  • Ivan (Vanya) Kashperuk Profile Picture
    on at

    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
    15 on at

    I did just now, and it worked. Thanks!

  • Community Member Profile Picture
    on at

    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

  • Suggested answer
    Randy33 Profile Picture
    47 on at

    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

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