Question Status

Verified
Bo Jensen asked a question on 8 May 2013 6:59 AM

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 :-) )

With Regards

Bo Jensen

Reply
Bilal Issa responded on 8 May 2013 3:36 PM

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

Reply
Bo Jensen responded on 14 May 2013 6:27 AM

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..

With Regards

Bo Jensen

Reply
Bilal Issa responded on 14 May 2013 7:25 AM

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

Reply
Verified Answer
Gustavo Silva responded on 14 May 2013 9:26 AM

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.

Reply
ZBlackie responded on 9 Jul 2014 9:13 AM

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

Thanks,

Zachary

Reply
Ivan Kashperuk responded on 9 Jul 2014 4:07 PM

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

Reply
ZBlackie responded on 10 Jul 2014 10:47 AM

I did just now, and it worked. Thanks!

Reply
Verified Answer
Gustavo Silva responded on 14 May 2013 9:26 AM

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.

Reply