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 :
Finance | Project Operations, Human Resources, ...
Suggested Answer

The display method on the data source in AX 2012 cannot obtain complete data

(0) ShareShare
ReportReport
Posted on by 131

I tried adding this method to the InventSum data source table to obtain the InventBatch table, but the Display method failed to obtain the InventDimId value.

I can only get the value of itemId and not the value of InventDimId. Why?What should I do?

pastedimage1603262692223v1.png

display  ExpirationDate ExpDate(InventSum _inventSum)
{
    ItemId          d_itemId        = inventSum.ItemId;
    InventDimId     d_InventDimId   = inventSum.InventDimId;

    InventBatchId d_batch = InventDim::find(d_InventDimId).inventBatchId;
    ExpirationDate l_date = InventBatch::find(d_batch,d_itemId).expDate;

    return l_date;
}

I have the same question (0)
  • Suggested answer
    Martin Dráb Profile Picture
    237,896 Most Valuable Professional on at

    The problem isn't in the code above - the problem is in what query the form uses. It seems it uses grouping and the fields that are neither grouped by not aggregated simply don't have any value fetched from the database.

    If you're interested in details, look at the form in question. If you don't understand what's going on and you need help, tell us which form it is.

  • István Orosz Profile Picture
    2,137 on at

    Hi Danzel,

    InventSum record buffer is empty - you should first fix the query behind.

  • Martin Dráb Profile Picture
    237,896 Most Valuable Professional on at

    It's not completely empty - it has ItemId and quantities. That's why I assume it's actually grouped. It explains the empty RecId as well - as with other fields, the value of RecId isn't defined if it's neither grouped by nor aggregated.

  • Danzel Zuo Profile Picture
    131 on at

    Thank you for your reply,This is a Form of personalized development, similar to the summary of on-hand Inventory(Show the inventory quantity  of all Items)

    Path:Product information management/Common/Released products->Manage inventory->on-hand Inventory

  • Gunjan Bhattachayya Profile Picture
    35,423 on at

    You are passing the table buffer (_inventSum) to the display method and are not using it. Can you try this and check if you get any value for InventDimId?

    InventDimId     d_InventDimId   = _inventSum.InventDimId;

  • Danzel Zuo Profile Picture
    131 on at

    Thank you for your reply. I wrote it in line 4 of the code

  • Gunjan Bhattachayya Profile Picture
    35,423 on at

    In line 4 of the, you are using the variable d_InventDimId. But you are not using the active buffer that is passed into the display method.

    Please try this code and check if you are getting the InventDimId value

    display  ExpirationDate ExpDate(InventSum _inventSum)
    {
        ItemId          d_itemId        = _inventSum.ItemId;
        InventDimId     d_InventDimId   = _inventSum.InventDimId;
    
        InventBatchId d_batch = InventDim::find(d_InventDimId).inventBatchId;
        ExpirationDate l_date = InventBatch::find(d_batch,d_itemId).expDate;
    
        return l_date;
    }

  • Danzel Zuo Profile Picture
    131 on at

    Try your code and still cannot get the InventDimId value, you post the same code as mine,thanks again

  • Gunjan Bhattachayya Profile Picture
    35,423 on at

    Since this is a custom form based on On hand inventory form, could you please share the query being used for the data source?

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 > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 544 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 450 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 250 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans