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 :-) )
InventSum form uses InventSum::queryAddSumFields(inventSum_DS.query().dataSourceTable(tableNum(InventSum))) methode to init query , please t add your fields in that method.
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..
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);
so you need the use addGroupByField , to show them.
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.
Has there been a confirmed way to do this? I'm having the same issue.
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?
Ivan (Vanya) Kashperuk
Senior Software Engineer @ MDCC
My Blog about Dynamics AX
I did just now, and it worked. Thanks!
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